From 3e91aaace271f8b513f8823255e8a9e2f7c44168 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 3 Dec 2024 19:06:36 +0000 Subject: [PATCH] CodeGen from PR 30779 in Azure/azure-rest-api-specs Merge fb337e77bc9bb7f1af58f6c61a9d94f84ac33990 into d0c3a661b6478798a1b028d4ddbb4633f634e808 --- sdk/eventgrid/azure-eventgrid/_meta.json | 6 + .../azure/eventgrid/__init__.py | 17 +- .../azure/eventgrid/_client.py | 183 - .../azure/eventgrid/_configuration.py | 132 - .../azure/eventgrid/_legacy/__init__.py | 19 - .../azure/eventgrid/_legacy/_constants.py | 10 - .../eventgrid/_legacy/_event_mappings.py | 537 - .../eventgrid/_legacy/_generated/__init__.py | 23 - .../eventgrid/_legacy/_generated/_client.py | 71 - .../_legacy/_generated/_configuration.py | 51 - .../_generated/_operations/__init__.py | 19 - .../_generated/_operations/_operations.py | 401 - .../_legacy/_generated/_operations/_patch.py | 20 - .../eventgrid/_legacy/_generated/_patch.py | 20 - .../_legacy/_generated/_serialization.py | 2027 --- .../eventgrid/_legacy/_generated/_vendor.py | 26 - .../_legacy/_generated/aio/__init__.py | 23 - .../_legacy/_generated/aio/_client.py | 71 - .../_legacy/_generated/aio/_configuration.py | 51 - .../_generated/aio/_operations/__init__.py | 19 - .../_generated/aio/_operations/_operations.py | 319 - .../_generated/aio/_operations/_patch.py | 20 - .../_legacy/_generated/aio/_patch.py | 20 - .../_legacy/_generated/aio/_vendor.py | 26 - .../_legacy/_generated/models/__init__.py | 26 - .../_legacy/_generated/models/_models.py | 301 - .../_legacy/_generated/models/_patch.py | 20 - .../eventgrid/_legacy/_generated/py.typed | 1 - .../azure/eventgrid/_legacy/_helpers.py | 187 - .../eventgrid/_legacy/_messaging_shared.py | 46 - .../azure/eventgrid/_legacy/_models.py | 112 - .../azure/eventgrid/_legacy/_policies.py | 48 - .../eventgrid/_legacy/_publisher_client.py | 250 - .../_legacy/_signature_credential_policy.py | 35 - .../azure/eventgrid/_legacy/_version.py | 12 - .../azure/eventgrid/_legacy/aio/__init__.py | 9 - .../_legacy/aio/_publisher_client_async.py | 242 - .../azure/eventgrid/_model_base.py | 362 +- .../azure/eventgrid/_operations/__init__.py | 21 - .../eventgrid/_operations/_operations.py | 1268 -- .../azure/eventgrid/_operations/_patch.py | 349 - .../azure-eventgrid/azure/eventgrid/_patch.py | 142 +- .../azure/eventgrid/_serialization.py | 432 +- .../azure/eventgrid/_validation.py | 50 - .../azure/eventgrid/_vendor.py | 35 - .../azure/eventgrid/_version.py | 2 +- .../azure/eventgrid/aio/__init__.py | 25 - .../azure/eventgrid/aio/_client.py | 191 - .../azure/eventgrid/aio/_configuration.py | 136 - .../eventgrid/aio/_operations/__init__.py | 21 - .../eventgrid/aio/_operations/_operations.py | 1055 -- .../azure/eventgrid/aio/_operations/_patch.py | 279 - .../azure/eventgrid/aio/_patch.py | 149 - .../azure/eventgrid/aio/_vendor.py | 35 - .../azure/eventgrid/models/__init__.py | 613 +- .../azure/eventgrid/models/_enums.py | 669 +- .../azure/eventgrid/models/_models.py | 13397 +++++++++++++++- .../azure/eventgrid/models/_patch.py | 75 +- sdk/eventgrid/azure-eventgrid/setup.py | 4 +- .../azure-eventgrid/tsp-location.yaml | 8 +- 60 files changed, 15049 insertions(+), 9669 deletions(-) create mode 100644 sdk/eventgrid/azure-eventgrid/_meta.json delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_constants.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_event_mappings.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_client.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_configuration.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_operations.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_serialization.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_vendor.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_client.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_configuration.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_operations.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_vendor.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_models.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/py.typed delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_helpers.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_messaging_shared.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_models.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_policies.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_signature_credential_policy.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_version.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/_publisher_client_async.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/_vendor.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_client.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_configuration.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/__init__.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_patch.py delete mode 100644 sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_vendor.py diff --git a/sdk/eventgrid/azure-eventgrid/_meta.json b/sdk/eventgrid/azure-eventgrid/_meta.json new file mode 100644 index 0000000000000..2d282f9a69e26 --- /dev/null +++ b/sdk/eventgrid/azure-eventgrid/_meta.json @@ -0,0 +1,6 @@ +{ + "commit": "68869aaa5472e4e1c74ff89421a6edad303af9aa", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents", + "@azure-tools/typespec-python": "0.36.5" +} \ No newline at end of file diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py index 7189e7b5a4f90..4c6ee2816f5af 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py @@ -5,24 +5,25 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import EventGridPublisherClient -from ._patch import EventGridConsumerClient from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = [ - "EventGridPublisherClient", - "EventGridConsumerClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py deleted file mode 100644 index c6ce28f47f9aa..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py +++ /dev/null @@ -1,183 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING, Union - -from azure.core import PipelineClient -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import EventGridConsumerClientConfiguration, EventGridPublisherClientConfiguration -from ._operations import EventGridConsumerClientOperationsMixin, EventGridPublisherClientOperationsMixin -from ._serialization import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class EventGridPublisherClient( - EventGridPublisherClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGridPublisherClient. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - _endpoint = "{endpoint}" - self._config = EventGridPublisherClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "EventGridPublisherClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class EventGridConsumerClient( - EventGridConsumerClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGridConsumerClient. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - _endpoint = "{endpoint}" - self._config = EventGridConsumerClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "EventGridConsumerClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py deleted file mode 100644 index 93540c21e18c5..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING, Union - -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import policies - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class EventGridPublisherClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EventGridPublisherClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") - - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.endpoint = endpoint - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://eventgrid.azure.net/.default"]) - kwargs.setdefault("sdk_moniker", "eventgrid/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _infer_policy(self, **kwargs): - if isinstance(self.credential, AzureKeyCredential): - return policies.AzureKeyCredentialPolicy( - self.credential, "Authorization", prefix="SharedAccessKey", **kwargs - ) - if hasattr(self.credential, "get_token"): - return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) - raise TypeError(f"Unsupported credential: {self.credential}") - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = self._infer_policy(**kwargs) - - -class EventGridConsumerClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EventGridConsumerClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") - - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.endpoint = endpoint - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://eventgrid.azure.net/.default"]) - kwargs.setdefault("sdk_moniker", "eventgrid/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _infer_policy(self, **kwargs): - if isinstance(self.credential, AzureKeyCredential): - return policies.AzureKeyCredentialPolicy( - self.credential, "Authorization", prefix="SharedAccessKey", **kwargs - ) - if hasattr(self.credential, "get_token"): - return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) - raise TypeError(f"Unsupported credential: {self.credential}") - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/__init__.py deleted file mode 100644 index 1dc3655a13bbc..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- - -from ._publisher_client import EventGridPublisherClient -from ._event_mappings import SystemEventNames -from ._helpers import generate_sas -from ._models import EventGridEvent -from ._version import VERSION - -__all__ = [ - "EventGridPublisherClient", - "EventGridEvent", - "generate_sas", - "SystemEventNames", -] -__version__ = VERSION diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_constants.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_constants.py deleted file mode 100644 index c246323f9476c..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_constants.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -DEFAULT_EVENTGRID_SCOPE = "https://eventgrid.azure.net/.default" -EVENTGRID_KEY_HEADER = "aeg-sas-key" -EVENTGRID_TOKEN_HEADER = "aeg-sas-token" -DEFAULT_API_VERSION = "2018-01-01" -SAFE_ENCODE = "~()*!.'" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_event_mappings.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_event_mappings.py deleted file mode 100644 index ed9f5e4d91e35..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_event_mappings.py +++ /dev/null @@ -1,537 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. - -# THE VALUES IN THE ENUM ARE AUTO-GENERATED. DO NOT EDIT THIS MANUALLY. -# -------------------------------------------------------------------------------------------- -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -# pylint: disable=line-too-long -# pylint: disable=enum-must-be-uppercase -class SystemEventNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ - This enum represents the names of the various event types for the system events published to - Azure Event Grid. To check the list of recognizable system topics, - visit https://docs.microsoft.com/azure/event-grid/system-topics. - """ - - # These names at the top are 'corrected' aliases of duplicate values that appear below, which are - # deprecated but maintained for backwards compatibility. - AcsChatMemberAddedToThreadWithUserEventName = "Microsoft.Communication.ChatMemberAddedToThreadWithUser" - - ResourceWriteFailureEventName = "Microsoft.Resources.ResourceWriteFailure" - - IoTHubDeviceDeletedEventName = "Microsoft.Devices.DeviceDeleted" - - IoTHubDeviceDisconnectedEventName = "Microsoft.Devices.DeviceDisconnected" - - ResourceDeleteFailureEventName = "Microsoft.Resources.ResourceDeleteFailure" - - ResourceDeleteCancelEventName = "Microsoft.Resources.ResourceDeleteCancel" - - AcsChatThreadParticipantAddedEventName = "Microsoft.Communication.ChatThreadParticipantAdded" - - ResourceDeleteSuccessEventName = "Microsoft.Resources.ResourceDeleteSuccess" - - EventGridSubscriptionValidationEventName = "Microsoft.EventGrid.SubscriptionValidationEvent" - - ResourceWriteSuccessEventName = "Microsoft.Resources.ResourceWriteSuccess" - - ResourceActionSuccessEventName = "Microsoft.Resources.ResourceActionSuccess" - - ResourceWriteCancelEventName = "Microsoft.Resources.ResourceWriteCancel" - - ResourceActionFailureEventName = "Microsoft.Resources.ResourceActionFailure" - - AcsChatMemberRemovedFromThreadWithUserEventName = "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser" - - IoTHubDeviceConnectedEventName = "Microsoft.Devices.DeviceConnected" - - EventGridSubscriptionDeletedEventName = "Microsoft.EventGrid.SubscriptionDeletedEvent" - - AcsChatThreadParticipantRemovedEventName = "Microsoft.Communication.ChatThreadParticipantRemoved" - - ResourceActionCancelEventName = "Microsoft.Resources.ResourceActionCancel" - - IoTHubDeviceCreatedEventName = "Microsoft.Devices.DeviceCreated" - - # Aliases end here - AcsAdvancedMessageDeliveryStatusUpdatedEventName = "Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated" - - AcsAdvancedMessageReceivedEventName = "Microsoft.Communication.AdvancedMessageReceived" - - AcsChatMessageDeletedEventName = "Microsoft.Communication.ChatMessageDeleted" - - AcsChatMessageDeletedInThreadEventName = "Microsoft.Communication.ChatMessageDeletedInThread" - - AcsChatMessageEditedEventName = "Microsoft.Communication.ChatMessageEdited" - - AcsChatMessageEditedInThreadEventName = "Microsoft.Communication.ChatMessageEditedInThread" - - AcsChatMessageReceivedEventName = "Microsoft.Communication.ChatMessageReceived" - - AcsChatMessageReceivedInThreadEventName = "Microsoft.Communication.ChatMessageReceivedInThread" - - AcsChatParticipantAddedToThreadEventName = "Microsoft.Communication.ChatThreadParticipantAdded" - - AcsChatParticipantAddedToThreadWithUserEventName = "Microsoft.Communication.ChatParticipantAddedToThreadWithUser" - - AcsChatParticipantRemovedFromThreadEventName = "Microsoft.Communication.ChatThreadParticipantRemoved" - - AcsChatParticipantRemovedFromThreadWithUserEventName = ( - "Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser" - ) - - AcsChatThreadCreatedEventName = "Microsoft.Communication.ChatThreadCreated" - - AcsChatThreadCreatedWithUserEventName = "Microsoft.Communication.ChatThreadCreatedWithUser" - - AcsChatThreadDeletedEventName = "Microsoft.Communication.ChatThreadDeleted" - - AcsChatThreadPropertiesUpdatedEventName = "Microsoft.Communication.ChatThreadPropertiesUpdated" - - AcsChatThreadPropertiesUpdatedPerUserEventName = "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser" - - AcsChatThreadWithUserDeletedEventName = "Microsoft.Communication.ChatThreadWithUserDeleted" - - AcsEmailDeliveryReportReceivedEventName = "Microsoft.Communication.EmailDeliveryReportReceived" - - AcsEmailEngagementTrackingReportReceivedEventName = "Microsoft.Communication.EmailEngagementTrackingReportReceived" - - AcsIncomingCallEventName = "Microsoft.Communication.IncomingCall" - - AcsRecordingFileStatusUpdatedEventName = "Microsoft.Communication.RecordingFileStatusUpdated" - - AcsRouterJobCancelledEventName = "Microsoft.Communication.RouterJobCancelled" - - AcsRouterJobClassificationFailedEventName = "Microsoft.Communication.RouterJobClassificationFailed" - - AcsRouterJobClassifiedEventName = "Microsoft.Communication.RouterJobClassified" - - AcsRouterJobClosedEventName = "Microsoft.Communication.RouterJobClosed" - - AcsRouterJobCompletedEventName = "Microsoft.Communication.RouterJobCompleted" - - AcsRouterJobDeletedEventName = "Microsoft.Communication.RouterJobDeleted" - - AcsRouterJobExceptionTriggeredEventName = "Microsoft.Communication.RouterJobExceptionTriggered" - - AcsRouterJobQueuedEventName = "Microsoft.Communication.RouterJobQueued" - - AcsRouterJobReceivedEventName = "Microsoft.Communication.RouterJobReceived" - - AcsRouterJobSchedulingFailedEventName = "Microsoft.Communication.RouterJobSchedulingFailed" - - AcsRouterJobUnassignedEventName = "Microsoft.Communication.RouterJobUnassigned" - - AcsRouterJobWaitingForActivationEventName = "Microsoft.Communication.RouterJobWaitingForActivation" - - AcsRouterJobWorkerSelectorsExpiredEventName = "Microsoft.Communication.RouterJobWorkerSelectorsExpired" - - AcsRouterWorkerDeletedEventName = "Microsoft.Communication.RouterWorkerDeleted" - - AcsRouterWorkerDeregisteredEventName = "Microsoft.Communication.RouterWorkerDeregistered" - - AcsRouterWorkerOfferAcceptedEventName = "Microsoft.Communication.RouterWorkerOfferAccepted" - - AcsRouterWorkerOfferDeclinedEventName = "Microsoft.Communication.RouterWorkerOfferDeclined" - - AcsRouterWorkerOfferExpiredEventName = "Microsoft.Communication.RouterWorkerOfferExpired" - - AcsRouterWorkerOfferIssuedEventName = "Microsoft.Communication.RouterWorkerOfferIssued" - - AcsRouterWorkerOfferRevokedEventName = "Microsoft.Communication.RouterWorkerOfferRevoked" - - AcsRouterWorkerRegisteredEventName = "Microsoft.Communication.RouterWorkerRegistered" - - AcsRouterWorkerUpdatedEventName = "Microsoft.Communication.RouterWorkerUpdated" - - AcsSmsDeliveryReportReceivedEventName = "Microsoft.Communication.SMSDeliveryReportReceived" - - AcsSmsReceivedEventName = "Microsoft.Communication.SMSReceived" - - AcsUserDisconnectedEventName = "Microsoft.Communication.UserDisconnected" - - ApiCenterApiDefinitionAddedEventName = "Microsoft.ApiCenter.ApiDefinitionAdded" - - ApiCenterApiDefinitionUpdatedEventName = "Microsoft.ApiCenter.ApiDefinitionUpdated" - - ApiManagementApiCreatedEventName = "Microsoft.ApiManagement.APICreated" - - ApiManagementApiDeletedEventName = "Microsoft.ApiManagement.APIDeleted" - - ApiManagementApiReleaseCreatedEventName = "Microsoft.ApiManagement.APIReleaseCreated" - - ApiManagementApiReleaseDeletedEventName = "Microsoft.ApiManagement.APIReleaseDeleted" - - ApiManagementApiReleaseUpdatedEventName = "Microsoft.ApiManagement.APIReleaseUpdated" - - ApiManagementApiUpdatedEventName = "Microsoft.ApiManagement.APIUpdated" - - ApiManagementGatewayApiAddedEventName = "Microsoft.ApiManagement.GatewayAPIAdded" - - ApiManagementGatewayApiRemovedEventName = "Microsoft.ApiManagement.GatewayAPIRemoved" - - ApiManagementGatewayCertificateAuthorityCreatedEventName = ( - "Microsoft.ApiManagement.GatewayCertificateAuthorityCreated" - ) - - ApiManagementGatewayCertificateAuthorityDeletedEventName = ( - "Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted" - ) - - ApiManagementGatewayCertificateAuthorityUpdatedEventName = ( - "Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated" - ) - - ApiManagementGatewayCreatedEventName = "Microsoft.ApiManagement.GatewayCreated" - - ApiManagementGatewayDeletedEventName = "Microsoft.ApiManagement.GatewayDeleted" - - ApiManagementGatewayHostnameConfigurationCreatedEventName = ( - "Microsoft.ApiManagement.GatewayHostnameConfigurationCreated" - ) - - ApiManagementGatewayHostnameConfigurationDeletedEventName = ( - "Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted" - ) - - ApiManagementGatewayHostnameConfigurationUpdatedEventName = ( - "Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated" - ) - - ApiManagementGatewayUpdatedEventName = "Microsoft.ApiManagement.GatewayUpdated" - - ApiManagementProductCreatedEventName = "Microsoft.ApiManagement.ProductCreated" - - ApiManagementProductDeletedEventName = "Microsoft.ApiManagement.ProductDeleted" - - ApiManagementProductUpdatedEventName = "Microsoft.ApiManagement.ProductUpdated" - - ApiManagementSubscriptionCreatedEventName = "Microsoft.ApiManagement.SubscriptionCreated" - - ApiManagementSubscriptionDeletedEventName = "Microsoft.ApiManagement.SubscriptionDeleted" - - ApiManagementSubscriptionUpdatedEventName = "Microsoft.ApiManagement.SubscriptionUpdated" - - ApiManagementUserCreatedEventName = "Microsoft.ApiManagement.UserCreated" - - ApiManagementUserDeletedEventName = "Microsoft.ApiManagement.UserDeleted" - - ApiManagementUserUpdatedEventName = "Microsoft.ApiManagement.UserUpdated" - - AppConfigurationKeyValueDeletedEventName = "Microsoft.AppConfiguration.KeyValueDeleted" - - AppConfigurationKeyValueModifiedEventName = "Microsoft.AppConfiguration.KeyValueModified" - - AppConfigurationSnapshotCreatedEventName = "Microsoft.AppConfiguration.SnapshotCreated" - - AppConfigurationSnapshotModifiedEventName = "Microsoft.AppConfiguration.SnapshotModified" - - AvsClusterCreatedEventName = "Microsoft.AVS.ClusterCreated" - - AvsClusterDeletedEventName = "Microsoft.AVS.ClusterDeleted" - - AvsClusterFailedEventName = "Microsoft.AVS.ClusterFailed" - - AvsClusterUpdatedEventName = "Microsoft.AVS.ClusterUpdated" - - AvsClusterUpdatingEventName = "Microsoft.AVS.ClusterUpdating" - - AvsPrivateCloudFailedEventName = "Microsoft.AVS.PrivateCloudFailed" - - AvsPrivateCloudUpdatedEventName = "Microsoft.AVS.PrivateCloudUpdated" - - AvsPrivateCloudUpdatingEventName = "Microsoft.AVS.PrivateCloudUpdating" - - AvsScriptExecutionCancelledEventName = "Microsoft.AVS.ScriptExecutionCancelled" - - AvsScriptExecutionFailedEventName = "Microsoft.AVS.ScriptExecutionFailed" - - AvsScriptExecutionFinishedEventName = "Microsoft.AVS.ScriptExecutionFinished" - - AvsScriptExecutionStartedEventName = "Microsoft.AVS.ScriptExecutionStarted" - - ContainerRegistryChartDeletedEventName = "Microsoft.ContainerRegistry.ChartDeleted" - - ContainerRegistryChartPushedEventName = "Microsoft.ContainerRegistry.ChartPushed" - - ContainerRegistryImageDeletedEventName = "Microsoft.ContainerRegistry.ImageDeleted" - - ContainerRegistryImagePushedEventName = "Microsoft.ContainerRegistry.ImagePushed" - - ContainerServiceClusterSupportEndedEventName = "Microsoft.ContainerService.ClusterSupportEnded" - - ContainerServiceClusterSupportEndingEventName = "Microsoft.ContainerService.ClusterSupportEnding" - - ContainerServiceNewKubernetesVersionAvailableEventName = "Microsoft.ContainerService.NewKubernetesVersionAvailable" - - ContainerServiceNodePoolRollingFailedEventName = "Microsoft.ContainerService.NodePoolRollingFailed" - - ContainerServiceNodePoolRollingStartedEventName = "Microsoft.ContainerService.NodePoolRollingStarted" - - ContainerServiceNodePoolRollingSucceededEventName = "Microsoft.ContainerService.NodePoolRollingSucceeded" - - DataBoxCopyCompletedEventName = "Microsoft.DataBox.CopyCompleted" - - DataBoxCopyStartedEventName = "Microsoft.DataBox.CopyStarted" - - DataBoxOrderCompletedEventName = "Microsoft.DataBox.OrderCompleted" - - EventGridMQTTClientCreatedOrUpdatedEventName = "Microsoft.EventGrid.MQTTClientCreatedOrUpdated" - - EventGridMQTTClientDeletedEventName = "Microsoft.EventGrid.MQTTClientDeleted" - - EventGridMQTTClientSessionConnectedEventName = "Microsoft.EventGrid.MQTTClientSessionConnected" - - EventGridMQTTClientSessionDisconnectedEventName = "Microsoft.EventGrid.MQTTClientSessionDisconnected" - - EventHubCaptureFileCreatedEventName = "Microsoft.EventHub.CaptureFileCreated" - - HealthcareDicomImageCreatedEventName = "Microsoft.HealthcareApis.DicomImageCreated" - - HealthcareDicomImageDeletedEventName = "Microsoft.HealthcareApis.DicomImageDeleted" - - HealthcareDicomImageUpdatedEventName = "Microsoft.HealthcareApis.DicomImageUpdated" - - HealthcareFhirResourceCreatedEventName = "Microsoft.HealthcareApis.FhirResourceCreated" - - HealthcareFhirResourceDeletedEventName = "Microsoft.HealthcareApis.FhirResourceDeleted" - - HealthcareFhirResourceUpdatedEventName = "Microsoft.HealthcareApis.FhirResourceUpdated" - - IotHubDeviceConnectedEventName = "Microsoft.Devices.DeviceConnected" - - IotHubDeviceCreatedEventName = "Microsoft.Devices.DeviceCreated" - - IotHubDeviceDeletedEventName = "Microsoft.Devices.DeviceDeleted" - - IotHubDeviceDisconnectedEventName = "Microsoft.Devices.DeviceDisconnected" - - IotHubDeviceTelemetryEventName = "Microsoft.Devices.DeviceTelemetry" - - KeyVaultCertificateExpiredEventName = "Microsoft.KeyVault.CertificateExpired" - - KeyVaultCertificateNearExpiryEventName = "Microsoft.KeyVault.CertificateNearExpiry" - - KeyVaultCertificateNewVersionCreatedEventName = "Microsoft.KeyVault.CertificateNewVersionCreated" - - KeyVaultKeyExpiredEventName = "Microsoft.KeyVault.KeyExpired" - - KeyVaultKeyNearExpiryEventName = "Microsoft.KeyVault.KeyNearExpiry" - - KeyVaultKeyNewVersionCreatedEventName = "Microsoft.KeyVault.KeyNewVersionCreated" - - KeyVaultSecretExpiredEventName = "Microsoft.KeyVault.SecretExpired" - - KeyVaultSecretNearExpiryEventName = "Microsoft.KeyVault.SecretNearExpiry" - - KeyVaultSecretNewVersionCreatedEventName = "Microsoft.KeyVault.SecretNewVersionCreated" - - KeyVaultVaultAccessPolicyChangedEventName = "Microsoft.KeyVault.VaultAccessPolicyChanged" - - MachineLearningServicesDatasetDriftDetectedEventName = "Microsoft.MachineLearningServices.DatasetDriftDetected" - - MachineLearningServicesModelDeployedEventName = "Microsoft.MachineLearningServices.ModelDeployed" - - MachineLearningServicesModelRegisteredEventName = "Microsoft.MachineLearningServices.ModelRegistered" - - MachineLearningServicesRunCompletedEventName = "Microsoft.MachineLearningServices.RunCompleted" - - MachineLearningServicesRunStatusChangedEventName = "Microsoft.MachineLearningServices.RunStatusChanged" - - MapsGeofenceEnteredEventName = "Microsoft.Maps.GeofenceEntered" - - MapsGeofenceExitedEventName = "Microsoft.Maps.GeofenceExited" - - MapsGeofenceResultEventName = "Microsoft.Maps.GeofenceResult" - - MediaJobCanceledEventName = "Microsoft.Media.JobCanceled" - - MediaJobCancelingEventName = "Microsoft.Media.JobCanceling" - - MediaJobErroredEventName = "Microsoft.Media.JobErrored" - - MediaJobFinishedEventName = "Microsoft.Media.JobFinished" - - MediaJobOutputCanceledEventName = "Microsoft.Media.JobOutputCanceled" - - MediaJobOutputCancelingEventName = "Microsoft.Media.JobOutputCanceling" - - MediaJobOutputErroredEventName = "Microsoft.Media.JobOutputErrored" - - MediaJobOutputFinishedEventName = "Microsoft.Media.JobOutputFinished" - - MediaJobOutputProcessingEventName = "Microsoft.Media.JobOutputProcessing" - - MediaJobOutputProgressEventName = "Microsoft.Media.JobOutputProgress" - - MediaJobOutputScheduledEventName = "Microsoft.Media.JobOutputScheduled" - - MediaJobOutputStateChangeEventName = "Microsoft.Media.JobOutputStateChange" - - MediaJobProcessingEventName = "Microsoft.Media.JobProcessing" - - MediaJobScheduledEventName = "Microsoft.Media.JobScheduled" - - MediaJobStateChangeEventName = "Microsoft.Media.JobStateChange" - - MediaLiveEventChannelArchiveHeartbeatEventName = "Microsoft.Media.LiveEventChannelArchiveHeartbeat" - - MediaLiveEventConnectionRejectedEventName = "Microsoft.Media.LiveEventConnectionRejected" - - MediaLiveEventEncoderConnectedEventName = "Microsoft.Media.LiveEventEncoderConnected" - - MediaLiveEventEncoderDisconnectedEventName = "Microsoft.Media.LiveEventEncoderDisconnected" - - MediaLiveEventIncomingDataChunkDroppedEventName = "Microsoft.Media.LiveEventIncomingDataChunkDropped" - - MediaLiveEventIncomingStreamReceivedEventName = "Microsoft.Media.LiveEventIncomingStreamReceived" - - MediaLiveEventIncomingStreamsOutOfSyncEventName = "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" - - MediaLiveEventIncomingVideoStreamsOutOfSyncEventName = "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" - - MediaLiveEventIngestHeartbeatEventName = "Microsoft.Media.LiveEventIngestHeartbeat" - - MediaLiveEventTrackDiscontinuityDetectedEventName = "Microsoft.Media.LiveEventTrackDiscontinuityDetected" - - PolicyInsightsPolicyStateChangedEventName = "Microsoft.PolicyInsights.PolicyStateChanged" - - PolicyInsightsPolicyStateCreatedEventName = "Microsoft.PolicyInsights.PolicyStateCreated" - - PolicyInsightsPolicyStateDeletedEventName = "Microsoft.PolicyInsights.PolicyStateDeleted" - - RedisExportRDBCompletedEventName = "Microsoft.Cache.ExportRDBCompleted" - - RedisImportRDBCompletedEventName = "Microsoft.Cache.ImportRDBCompleted" - - RedisPatchingCompletedEventName = "Microsoft.Cache.PatchingCompleted" - - RedisScalingCompletedEventName = "Microsoft.Cache.ScalingCompleted" - - ResourceActionCancelName = "Microsoft.Resources.ResourceActionCancel" - - ResourceActionFailureName = "Microsoft.Resources.ResourceActionFailure" - - ResourceActionSuccessName = "Microsoft.Resources.ResourceActionSuccess" - - ResourceDeleteCancelName = "Microsoft.Resources.ResourceDeleteCancel" - - ResourceDeleteFailureName = "Microsoft.Resources.ResourceDeleteFailure" - - ResourceDeleteSuccessName = "Microsoft.Resources.ResourceDeleteSuccess" - - ResourceNotificationsContainerServiceEventResourcesScheduledEventName = ( - "Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted" - ) - - ResourceNotificationsHealthResourcesAnnotatedEventName = ( - "Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated" - ) - - ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventName = ( - "Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged" - ) - - ResourceNotificationsResourceManagementCreatedOrUpdatedEventName = ( - "Microsoft.ResourceNotifications.Resources.CreatedOrUpdated" - ) - - ResourceNotificationsResourceManagementDeletedEventName = "Microsoft.ResourceNotifications.Resources.Deleted" - - ResourceWriteCancelName = "Microsoft.Resources.ResourceWriteCancel" - - ResourceWriteFailureName = "Microsoft.Resources.ResourceWriteFailure" - - ResourceWriteSuccessName = "Microsoft.Resources.ResourceWriteSuccess" - - ServiceBusActiveMessagesAvailablePeriodicNotificationsEventName = ( - "Microsoft.ServiceBus.ActiveMessagesAvailablePeriodicNotifications" - ) - - ServiceBusActiveMessagesAvailableWithNoListenersEventName = ( - "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" - ) - - ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventName = ( - "Microsoft.ServiceBus.DeadletterMessagesAvailablePeriodicNotifications" - ) - - ServiceBusDeadletterMessagesAvailableWithNoListenersEventName = ( - "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners" - ) - - SignalRServiceClientConnectionConnectedEventName = "Microsoft.SignalRService.ClientConnectionConnected" - - SignalRServiceClientConnectionDisconnectedEventName = "Microsoft.SignalRService.ClientConnectionDisconnected" - - StorageAsyncOperationInitiatedEventName = "Microsoft.Storage.AsyncOperationInitiated" - - StorageBlobCreatedEventName = "Microsoft.Storage.BlobCreated" - - StorageBlobDeletedEventName = "Microsoft.Storage.BlobDeleted" - - StorageBlobInventoryPolicyCompletedEventName = "Microsoft.Storage.BlobInventoryPolicyCompleted" - - StorageBlobRenamedEventName = "Microsoft.Storage.BlobRenamed" - - StorageBlobTierChangedEventName = "Microsoft.Storage.BlobTierChanged" - - StorageDirectoryCreatedEventName = "Microsoft.Storage.DirectoryCreated" - - StorageDirectoryDeletedEventName = "Microsoft.Storage.DirectoryDeleted" - - StorageDirectoryRenamedEventName = "Microsoft.Storage.DirectoryRenamed" - - StorageLifecyclePolicyCompletedEventName = "Microsoft.Storage.LifecyclePolicyCompleted" - - StorageTaskAssignmentCompletedEventName = "Microsoft.Storage.StorageTaskAssignmentCompleted" - - StorageTaskAssignmentQueuedEventName = "Microsoft.Storage.StorageTaskAssignmentQueued" - - StorageTaskCompletedEventName = "Microsoft.Storage.StorageTaskCompleted" - - StorageTaskQueuedEventName = "Microsoft.Storage.StorageTaskQueued" - - SubscriptionDeletedEventName = "Microsoft.EventGrid.SubscriptionDeletedEvent" - - SubscriptionValidationEventName = "Microsoft.EventGrid.SubscriptionValidationEvent" - - WebAppServicePlanUpdatedEventName = "Microsoft.Web.AppServicePlanUpdated" - - WebAppUpdatedEventName = "Microsoft.Web.AppUpdated" - - WebBackupOperationCompletedEventName = "Microsoft.Web.BackupOperationCompleted" - - WebBackupOperationFailedEventName = "Microsoft.Web.BackupOperationFailed" - - WebBackupOperationStartedEventName = "Microsoft.Web.BackupOperationStarted" - - WebRestoreOperationCompletedEventName = "Microsoft.Web.RestoreOperationCompleted" - - WebRestoreOperationFailedEventName = "Microsoft.Web.RestoreOperationFailed" - - WebRestoreOperationStartedEventName = "Microsoft.Web.RestoreOperationStarted" - - WebSlotSwapCompletedEventName = "Microsoft.Web.SlotSwapCompleted" - - WebSlotSwapFailedEventName = "Microsoft.Web.SlotSwapFailed" - - WebSlotSwapStartedEventName = "Microsoft.Web.SlotSwapStarted" - - WebSlotSwapWithPreviewCancelledEventName = "Microsoft.Web.SlotSwapWithPreviewCancelled" - - WebSlotSwapWithPreviewStartedEventName = "Microsoft.Web.SlotSwapWithPreviewStarted" - - ContainerRegistryArtifactEventName = "Microsoft.AppConfiguration.KeyValueModified" - - KeyVaultAccessPolicyChangedEventName = "Microsoft.KeyVault.VaultAccessPolicyChanged" - - ContainerRegistryEventName = "Microsoft.ContainerRegistry.ChartPushed" - - ServiceBusDeadletterMessagesAvailableWithNoListenerEventName = ( - "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners" - ) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/__init__.py deleted file mode 100644 index 802c5324f6411..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._client import EventGridPublisherClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_client.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_client.py deleted file mode 100644 index f3ad2db7363a4..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_client.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any - -from azure.core import PipelineClient -from azure.core.rest import HttpRequest, HttpResponse - -from . import models as _models -from ._configuration import EventGridPublisherClientConfiguration -from ._operations import EventGridPublisherClientOperationsMixin -from ._serialization import Deserializer, Serializer - - -class EventGridPublisherClient( - EventGridPublisherClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGrid Python Publisher Client. - - :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential - _endpoint = "https://{topicHostname}" - self._config = EventGridPublisherClientConfiguration(**kwargs) - self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "EventGridPublisherClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_configuration.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_configuration.py deleted file mode 100644 index d105970e51f9a..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_configuration.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -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 - -VERSION = "unknown" - - -class EventGridPublisherClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for EventGridPublisherClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, **kwargs: Any) -> None: - super(EventGridPublisherClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2018-01-01"] = kwargs.pop("api_version", "2018-01-01") - - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "eventgridpublisherclient/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/__init__.py deleted file mode 100644 index 2223086fe7d0b..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import EventGridPublisherClientOperationsMixin - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClientOperationsMixin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_operations.py deleted file mode 100644 index 0ba43ddc6003a..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_operations.py +++ /dev/null @@ -1,401 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import EventGridPublisherClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_event_grid_publisher_publish_events_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: Literal["2018-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) - # Construct URL - _url = "/api/events" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_publisher_publish_cloud_event_events_request( - *, json: List[_models.CloudEvent], **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: Literal["2018-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) - # Construct URL - _url = "/api/events" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) - - -def build_event_grid_publisher_publish_custom_event_events_request( - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: Literal["2018-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) - # Construct URL - _url = "/api/events" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EventGridPublisherClientOperationsMixin(EventGridPublisherClientMixinABC): - @overload - def publish_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: List[_models.EventGridEvent], - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[~event_grid_publisher_client.models.EventGridEvent] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def publish_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: IO, - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def publish_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: Union[List[_models.EventGridEvent], IO], - **kwargs: Any, - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Is either a [EventGridEvent] - type or a IO type. Required. - :type events: list[~event_grid_publisher_client.models.EventGridEvent] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(events, (IO, bytes)): - _content = events - else: - _json = self._serialize.body(events, "[EventGridEvent]") - - request = build_event_grid_publisher_publish_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - @distributed_trace - def publish_cloud_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: List[_models.CloudEvent], **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[~event_grid_publisher_client.models.CloudEvent] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", - _headers.pop("Content-Type", "application/cloudevents-batch+json; charset=utf-8"), - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _json = self._serialize.body(events, "[CloudEvent]") - - request = build_event_grid_publisher_publish_cloud_event_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - @overload - def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: List[JSON], - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[JSON] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: IO, - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: Union[List[JSON], IO], **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Is either a [JSON] type or a - IO type. Required. - :type events: list[JSON] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(events, (IO, bytes)): - _content = events - else: - _json = self._serialize.body(events, "[object]") - - request = build_event_grid_publisher_publish_custom_event_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_serialization.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_serialization.py deleted file mode 100644 index 1e7a11b1d2569..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_serialization.py +++ /dev/null @@ -1,2027 +0,0 @@ -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# pylint: skip-file -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Dict, - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - TypeVar, - MutableMapping, - Type, - List, - Mapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from azure.core.exceptions import ( - DeserializationError, - SerializationError, - raise_with_traceback, -) -from azure.core.serialization import NULL as AzureCoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -ModelType = TypeVar("ModelType", bound="Model") -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) - elif "xml" in (content_type or []): - try: - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Dict[str, Any] = {} - for k in kwargs: - if k not in self._attribute_map: - _LOGGER.warning( - "%s is not a known attribute of class %s and will be ignored", - k, - self.__class__, - ) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning( - "Readonly attribute %s will be ignored in class %s", - k, - self.__class__, - ) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node.""" - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node( - xml_map.get("name", cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None), - ) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises: DeserializationError if something went wrong - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) - - @classmethod - def from_dict( - cls: Type[ModelType], - data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> ModelType: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises: DeserializationError if something went wrong - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__, - ) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - """ - return key.replace("\\.", ".") - - -class Serializer(object): - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize(self, target_obj, data_type=None, **kwargs): - """Serialize data into a string according to type. - - :param target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises: SerializationError if serialization fails. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() - try: - attributes = target_obj._attribute_map - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) - continue - try: - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - 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) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError: - continue - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) - except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is AzureCoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - elif data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param data: Object to be serialized. - :param str data_type: Type of object in the iterable. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param data: Object to be serialized. - :rtype: str - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - else: - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list attr: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - :rtype: list, str - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: - serialized.append(None) - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node( - node_name, - xml_desc.get("prefix", None), - xml_desc.get("ns", None), - ) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. - :rtype: dict - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - 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: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) - - @staticmethod - def serialize_bytearray(attr, **kwargs): - """Serialize bytearray into base-64 string. - - :param attr: Object to be serialized. - :rtype: str - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): - """Serialize str into base-64 string. - - :param attr: Object to be serialized. - :rtype: str - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): - """Serialize Decimal object to float. - - :param attr: Object to be serialized. - :rtype: float - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): - """Serialize long (Py2) or int (Py3). - - :param attr: Object to be serialized. - :rtype: int/long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises: TypeError if format invalid. - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises: SerializationError if format invalid. - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, - utc.tm_mon, - utc.tm_mday, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) - - @staticmethod - def serialize_unix(attr, **kwargs): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises: SerializationError if format invalid - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") - - -def rest_key_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer(object): - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: Dict[str, Type[ModelType]] = 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 - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, basestring): - return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None: - return data - try: - attributes = response._attribute_map # type: ignore - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - """ - if target is None: - return None, None - - if isinstance(target, basestring): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - """ - try: - return self(target_obj, data, content_type=content_type) - except: - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True, - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - 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"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param response: The response model class. - :param d_attrs: The deserialized response attributes. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) - - def deserialize_data(self, data, data_type): - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :rtype: dict - :raises: TypeError if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, basestring): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - elif isinstance(attr, basestring): - if attr.lower() in ["true", "1"]: - return True - elif attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - else: - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 - try: - return list(enum_obj.__members__.values())[data] - except IndexError: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning( - "Deserializer is not able to find %s as valid enum in %s", - data, - enum_obj, - ) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :rtype: bytearray - :raises: TypeError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :rtype: bytearray - :raises: TypeError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(attr) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :rtype: long or int - :raises: ValueError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :rtype: TimeDelta - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :rtype: Date - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :rtype: Datetime - :raises: DeserializationError if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_vendor.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_vendor.py deleted file mode 100644 index 46152be31b395..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EventGridPublisherClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -class EventGridPublisherClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: EventGridPublisherClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/__init__.py deleted file mode 100644 index 802c5324f6411..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._client import EventGridPublisherClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_client.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_client.py deleted file mode 100644 index f81ce4181ad6c..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_client.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .. import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import EventGridPublisherClientConfiguration -from ._operations import EventGridPublisherClientOperationsMixin - - -class EventGridPublisherClient( - EventGridPublisherClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGrid Python Publisher Client. - - :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential - _endpoint = "https://{topicHostname}" - self._config = EventGridPublisherClientConfiguration(**kwargs) - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "EventGridPublisherClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_configuration.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_configuration.py deleted file mode 100644 index 52c2f3551ad7c..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_configuration.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -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 - -VERSION = "unknown" - - -class EventGridPublisherClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for EventGridPublisherClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :keyword api_version: Api Version. Default value is "2018-01-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, **kwargs: Any) -> None: - super(EventGridPublisherClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2018-01-01"] = kwargs.pop("api_version", "2018-01-01") - - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "eventgridpublisherclient/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/__init__.py deleted file mode 100644 index 2223086fe7d0b..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import EventGridPublisherClientOperationsMixin - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClientOperationsMixin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_operations.py deleted file mode 100644 index ba6dc3ff67e5b..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_operations.py +++ /dev/null @@ -1,319 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._operations._operations import ( - build_event_grid_publisher_publish_cloud_event_events_request, - build_event_grid_publisher_publish_custom_event_events_request, - build_event_grid_publisher_publish_events_request, -) -from .._vendor import EventGridPublisherClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventGridPublisherClientOperationsMixin(EventGridPublisherClientMixinABC): - @overload - async def publish_events( # pylint: disable=inconsistent-return-statements - self, - topic_hostname: str, - events: List[_models.EventGridEvent], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[~event_grid_publisher_client.models.EventGridEvent] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def publish_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def publish_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: Union[List[_models.EventGridEvent], IO], **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Is either a [EventGridEvent] - type or a IO type. Required. - :type events: list[~event_grid_publisher_client.models.EventGridEvent] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(events, (IO, bytes)): - _content = events - else: - _json = self._serialize.body(events, "[EventGridEvent]") - - request = build_event_grid_publisher_publish_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - @distributed_trace_async - async def publish_cloud_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: List[_models.CloudEvent], **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[~event_grid_publisher_client.models.CloudEvent] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", - _headers.pop("Content-Type", "application/cloudevents-batch+json; charset=utf-8"), - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _json = self._serialize.body(events, "[CloudEvent]") - - request = build_event_grid_publisher_publish_cloud_event_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - @overload - async def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: List[JSON], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: list[JSON] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Required. - :type events: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def publish_custom_event_events( # pylint: disable=inconsistent-return-statements - self, topic_hostname: str, events: Union[List[JSON], IO], **kwargs: Any - ) -> None: - """Publishes a batch of events to an Azure Event Grid topic. - - :param topic_hostname: The host name of the topic, e.g. topic1.westus2-1.eventgrid.azure.net. - Required. - :type topic_hostname: str - :param events: An array of events to be published to Event Grid. Is either a [JSON] type or a - IO type. Required. - :type events: list[JSON] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(events, (IO, bytes)): - _content = events - else: - _json = self._serialize.body(events, "[object]") - - request = build_event_grid_publisher_publish_custom_event_events_request( - content_type=content_type, - api_version=self._config.api_version, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "topicHostname": self._serialize.url("topic_hostname", topic_hostname, "str", skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_vendor.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_vendor.py deleted file mode 100644 index 00914b6f308b2..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/aio/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EventGridPublisherClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class EventGridPublisherClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: EventGridPublisherClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/__init__.py deleted file mode 100644 index 2d1ec017aebad..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models import CloudEvent -from ._models import EventGridEvent -from ._models import SubscriptionDeletedEventData -from ._models import SubscriptionValidationEventData -from ._models import SubscriptionValidationResponse -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "CloudEvent", - "EventGridEvent", - "SubscriptionDeletedEventData", - "SubscriptionValidationEventData", - "SubscriptionValidationResponse", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_models.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_models.py deleted file mode 100644 index b4819fe41bbcb..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_models.py +++ /dev/null @@ -1,301 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -import sys -from typing import Any, Dict, Optional - -from .. import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class CloudEvent(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties of an event published to an Event Grid topic using the CloudEvent 1.0 Schema. - - All required parameters must be populated in order to send to Azure. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar id: An identifier for the event. The combination of id and source must be unique for each - distinct event. Required. - :vartype id: str - :ivar source: Identifies the context in which an event happened. The combination of id and - source must be unique for each distinct event. Required. - :vartype source: str - :ivar data: Event data specific to the event type. - :vartype data: JSON - :ivar data_base64: Event data specific to the event type, encoded as a base64 string. - :vartype data_base64: bytes - :ivar type: Type of event related to the originating occurrence. Required. - :vartype type: str - :ivar time: The time (in UTC) the event was generated, in RFC3339 format. - :vartype time: ~datetime.datetime - :ivar specversion: The version of the CloudEvents specification which the event uses. Required. - :vartype specversion: str - :ivar dataschema: Identifies the schema that data adheres to. - :vartype dataschema: str - :ivar datacontenttype: Content type of data value. - :vartype datacontenttype: str - :ivar subject: This describes the subject of the event in the context of the event producer - (identified by source). - :vartype subject: str - """ - - _validation = { - "id": {"required": True}, - "source": {"required": True}, - "type": {"required": True}, - "specversion": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "str"}, - "source": {"key": "source", "type": "str"}, - "data": {"key": "data", "type": "object"}, - "data_base64": {"key": "data_base64", "type": "bytearray"}, - "type": {"key": "type", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - "specversion": {"key": "specversion", "type": "str"}, - "dataschema": {"key": "dataschema", "type": "str"}, - "datacontenttype": {"key": "datacontenttype", "type": "str"}, - "subject": {"key": "subject", "type": "str"}, - } - - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - source: str, - type: str, - specversion: str, - additional_properties: Optional[Dict[str, Any]] = None, - data: Optional[JSON] = None, - data_base64: Optional[bytes] = None, - time: Optional[datetime.datetime] = None, - dataschema: Optional[str] = None, - datacontenttype: Optional[str] = None, - subject: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword id: An identifier for the event. The combination of id and source must be unique for - each distinct event. Required. - :paramtype id: str - :keyword source: Identifies the context in which an event happened. The combination of id and - source must be unique for each distinct event. Required. - :paramtype source: str - :keyword data: Event data specific to the event type. - :paramtype data: JSON - :keyword data_base64: Event data specific to the event type, encoded as a base64 string. - :paramtype data_base64: bytes - :keyword type: Type of event related to the originating occurrence. Required. - :paramtype type: str - :keyword time: The time (in UTC) the event was generated, in RFC3339 format. - :paramtype time: ~datetime.datetime - :keyword specversion: The version of the CloudEvents specification which the event uses. - Required. - :paramtype specversion: str - :keyword dataschema: Identifies the schema that data adheres to. - :paramtype dataschema: str - :keyword datacontenttype: Content type of data value. - :paramtype datacontenttype: str - :keyword subject: This describes the subject of the event in the context of the event producer - (identified by source). - :paramtype subject: str - """ - super().__init__(**kwargs) - self.additional_properties = additional_properties - self.id = id - self.source = source - self.data = data - self.data_base64 = data_base64 - self.type = type - self.time = time - self.specversion = specversion - self.dataschema = dataschema - self.datacontenttype = datacontenttype - self.subject = subject - - -class EventGridEvent(_serialization.Model): - """Properties of an event published to an Event Grid topic using the EventGrid Schema. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: An unique identifier for the event. Required. - :vartype id: str - :ivar topic: The resource path of the event source. - :vartype topic: str - :ivar subject: A resource path relative to the topic path. Required. - :vartype subject: str - :ivar data: Event data specific to the event type. Required. - :vartype data: JSON - :ivar event_type: The type of the event that occurred. Required. - :vartype event_type: str - :ivar event_time: The time (in UTC) the event was generated. Required. - :vartype event_time: ~datetime.datetime - :ivar metadata_version: The schema version of the event metadata. - :vartype metadata_version: str - :ivar data_version: The schema version of the data object. Required. - :vartype data_version: str - """ - - _validation = { - "id": {"required": True}, - "subject": {"required": True}, - "data": {"required": True}, - "event_type": {"required": True}, - "event_time": {"required": True}, - "metadata_version": {"readonly": True}, - "data_version": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "topic": {"key": "topic", "type": "str"}, - "subject": {"key": "subject", "type": "str"}, - "data": {"key": "data", "type": "object"}, - "event_type": {"key": "eventType", "type": "str"}, - "event_time": {"key": "eventTime", "type": "iso-8601"}, - "metadata_version": {"key": "metadataVersion", "type": "str"}, - "data_version": {"key": "dataVersion", "type": "str"}, - } - - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - subject: str, - data: JSON, - event_type: str, - event_time: datetime.datetime, - data_version: str, - topic: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: An unique identifier for the event. Required. - :paramtype id: str - :keyword topic: The resource path of the event source. - :paramtype topic: str - :keyword subject: A resource path relative to the topic path. Required. - :paramtype subject: str - :keyword data: Event data specific to the event type. Required. - :paramtype data: JSON - :keyword event_type: The type of the event that occurred. Required. - :paramtype event_type: str - :keyword event_time: The time (in UTC) the event was generated. Required. - :paramtype event_time: ~datetime.datetime - :keyword data_version: The schema version of the data object. Required. - :paramtype data_version: str - """ - super().__init__(**kwargs) - self.id = id - self.topic = topic - self.subject = subject - self.data = data - self.event_type = event_type - self.event_time = event_time - self.metadata_version: Optional[str] = None - self.data_version = data_version - - -class SubscriptionDeletedEventData(_serialization.Model): - """Schema of the Data property of an EventGridEvent for a - Microsoft.EventGrid.SubscriptionDeletedEvent event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar event_subscription_id: The Azure resource ID of the deleted event subscription. - :vartype event_subscription_id: str - """ - - _validation = { - "event_subscription_id": {"readonly": True}, - } - - _attribute_map = { - "event_subscription_id": {"key": "eventSubscriptionId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.event_subscription_id = None - - -class SubscriptionValidationEventData(_serialization.Model): - """Schema of the Data property of an EventGridEvent for a - Microsoft.EventGrid.SubscriptionValidationEvent event. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar validation_code: The validation code sent by Azure Event Grid to validate an event - subscription. To complete the validation handshake, the subscriber must either respond with - this validation code as part of the validation response, or perform a GET request on the - validationUrl (available starting version 2018-05-01-preview). - :vartype validation_code: str - :ivar validation_url: The validation URL sent by Azure Event Grid (available starting version - 2018-05-01-preview). To complete the validation handshake, the subscriber must either respond - with the validationCode as part of the validation response, or perform a GET request on the - validationUrl (available starting version 2018-05-01-preview). - :vartype validation_url: str - """ - - _validation = { - "validation_code": {"readonly": True}, - "validation_url": {"readonly": True}, - } - - _attribute_map = { - "validation_code": {"key": "validationCode", "type": "str"}, - "validation_url": {"key": "validationUrl", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.validation_code = None - self.validation_url = None - - -class SubscriptionValidationResponse(_serialization.Model): - """To complete an event subscription validation handshake, a subscriber can use either the - validationCode or the validationUrl received in a SubscriptionValidationEvent. When the - validationCode is used, the SubscriptionValidationResponse can be used to build the response. - - :ivar validation_response: The validation response sent by the subscriber to Azure Event Grid - to complete the validation of an event subscription. - :vartype validation_response: str - """ - - _attribute_map = { - "validation_response": {"key": "validationResponse", "type": "str"}, - } - - def __init__(self, *, validation_response: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword validation_response: The validation response sent by the subscriber to Azure Event - Grid to complete the validation of an event subscription. - :paramtype validation_response: str - """ - super().__init__(**kwargs) - self.validation_response = validation_response diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/py.typed b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_generated/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_helpers.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_helpers.py deleted file mode 100644 index 467466f6d9aac..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_helpers.py +++ /dev/null @@ -1,187 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Any, Dict -import json -import hashlib -import hmac -import base64 - -from urllib.parse import quote - -from azure.core.pipeline.transport import HttpRequest -from azure.core.pipeline.policies import ( - AzureKeyCredentialPolicy, - BearerTokenCredentialPolicy, -) -from azure.core.credentials import AzureKeyCredential, AzureSasCredential -from ._generated._serialization import Serializer -from ._signature_credential_policy import EventGridSasCredentialPolicy -from . import _constants as constants - -from ._generated.models import ( - CloudEvent as InternalCloudEvent, -) - -if TYPE_CHECKING: - from datetime import datetime - - -def generate_sas( - endpoint: str, - shared_access_key: str, - expiration_date_utc: "datetime", - *, - api_version: str = constants.DEFAULT_API_VERSION, -) -> str: - """Helper method to generate shared access signature given hostname, key, and expiration date. - :param str endpoint: The topic endpoint to send the events to. - Similar to .-1.eventgrid.azure.net - :param str shared_access_key: The shared access key to be used for generating the token - :param datetime.datetime expiration_date_utc: The expiration datetime in UTC for the signature. - :keyword str api_version: The API Version to include in the signature. - If not provided, the default API version will be used. - :return: A shared access signature string. - :rtype: str - - - .. admonition:: Example: - - .. literalinclude:: ../samples/basic/sync_samples/sample_generate_sas.py - :start-after: [START generate_sas] - :end-before: [END generate_sas] - :language: python - :dedent: 0 - :caption: Generate a shared access signature. - - """ - full_endpoint = "{}?apiVersion={}".format(endpoint, api_version) - encoded_resource = quote(full_endpoint, safe=constants.SAFE_ENCODE) - encoded_expiration_utc = quote(str(expiration_date_utc), safe=constants.SAFE_ENCODE) - - unsigned_sas = "r={}&e={}".format(encoded_resource, encoded_expiration_utc) - signature = quote(_generate_hmac(shared_access_key, unsigned_sas), safe=constants.SAFE_ENCODE) - signed_sas = "{}&s={}".format(unsigned_sas, signature) - return signed_sas - - -def _generate_hmac(key, message): - decoded_key = base64.b64decode(key) - bytes_message = message.encode("ascii") - hmac_new = hmac.new(decoded_key, bytes_message, hashlib.sha256).digest() - - return base64.b64encode(hmac_new) - - -def _get_authentication_policy(credential, bearer_token_policy=BearerTokenCredentialPolicy): - if credential is None: - raise ValueError("Parameter 'self._credential' must not be None.") - if hasattr(credential, "get_token"): - return bearer_token_policy(credential, constants.DEFAULT_EVENTGRID_SCOPE) - if isinstance(credential, AzureKeyCredential): - return AzureKeyCredentialPolicy(credential=credential, name=constants.EVENTGRID_KEY_HEADER) - if isinstance(credential, AzureSasCredential): - return EventGridSasCredentialPolicy(credential=credential, name=constants.EVENTGRID_TOKEN_HEADER) - raise ValueError( - "The provided credential should be an instance of a TokenCredential, AzureSasCredential or AzureKeyCredential" - ) - - -def _is_cloud_event(event): - # type: (Any) -> bool - required = ("id", "source", "specversion", "type") - try: - return all((_ in event for _ in required)) and event["specversion"] == "1.0" - except TypeError: - return False - - -def _is_eventgrid_event_format(event): - # type: (Any) -> bool - required = ("subject", "eventType", "data", "dataVersion", "id", "eventTime") - try: - return all((prop in event for prop in required)) - except TypeError: - return False - - -def _eventgrid_data_typecheck(event): - try: - data = event.get("data") - except AttributeError: - data = event.data - - if isinstance(data, bytes): - raise TypeError( - "Data in EventGridEvent cannot be bytes. Please refer to" - "https://docs.microsoft.com/en-us/azure/event-grid/event-schema" - ) - - -def _cloud_event_to_generated(cloud_event, **kwargs): - if isinstance(cloud_event.data, bytes): - data_base64 = cloud_event.data - data = None - else: - data = cloud_event.data - data_base64 = None - return InternalCloudEvent( - id=cloud_event.id, - source=cloud_event.source, - type=cloud_event.type, - specversion=cloud_event.specversion, - data=data, - data_base64=data_base64, - time=cloud_event.time, - dataschema=cloud_event.dataschema, - datacontenttype=cloud_event.datacontenttype, - subject=cloud_event.subject, - additional_properties=cloud_event.extensions, - **kwargs, - ) - - -def _from_cncf_events(event): # pylint: disable=inconsistent-return-statements - """This takes in a CNCF cloudevent and returns a dictionary. - If cloud events library is not installed, the event is returned back. - - :param event: The event to be serialized - :type event: cloudevents.http.CloudEvent - :return: The serialized event - :rtype: any - """ - try: - from cloudevents.http import to_json - - return json.loads(to_json(event)) - except (AttributeError, ImportError): - # means this is not a CNCF event - return event - except Exception as err: # pylint: disable=broad-except - msg = """Failed to serialize the event. Please ensure your - CloudEvents is correctly formatted (https://pypi.org/project/cloudevents/)""" - raise ValueError(msg) from err - - -def _build_request(endpoint, content_type, events, *, channel_name=None, api_version=constants.DEFAULT_API_VERSION): - serialize = Serializer() - header_parameters: Dict[str, Any] = {} - header_parameters["Content-Type"] = serialize.header("content_type", content_type, "str") - - if channel_name: - header_parameters["aeg-channel-name"] = channel_name - - query_parameters: Dict[str, Any] = {} - query_parameters["api-version"] = serialize.query("api_version", api_version, "str") - - body = serialize.body(events, "[object]") - if body is None: - data = None - else: - data = json.dumps(body) - header_parameters["Content-Length"] = str(len(data)) - - request = HttpRequest(method="POST", url=endpoint, headers=header_parameters, data=data) - request.format_parameters(query_parameters) - return request diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_messaging_shared.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_messaging_shared.py deleted file mode 100644 index a08af498bff04..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_messaging_shared.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -# ========================================================================== -# This file contains duplicate code that is shared with azure-eventgrid. -# Both the files should always be identical. -# ========================================================================== - -from typing import Any -import json - - -def _get_json_content(obj: Any) -> Any: # pylint: disable=inconsistent-return-statements - """Event mixin to have methods that are common to different Event types - like CloudEvent, EventGridEvent etc. - - :param obj: The object to get the JSON content from. - :type obj: any - :return: The JSON content from the object. - :rtype: any - :raises: ValueError if the JSON content cannot be loaded from the object. - """ - msg = "Failed to load JSON content from the object." - try: - # storage queue - return json.loads(obj.content) - except ValueError as err: - raise ValueError(msg) from err - except AttributeError: - # eventhubs - try: - return json.loads(next(obj.body))[0] - except KeyError: - # servicebus - return json.loads(next(obj.body)) - except ValueError as err: - raise ValueError(msg) from err - except: # pylint: disable=bare-except - try: - return json.loads(obj) - except ValueError as err: - raise ValueError(msg) from err diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_models.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_models.py deleted file mode 100644 index 6586e5e227939..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_models.py +++ /dev/null @@ -1,112 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint:disable=protected-access -from typing import Any, cast -import datetime as dt -import uuid -from ._messaging_shared import _get_json_content -from ._generated.models import ( - EventGridEvent as InternalEventGridEvent, -) - - -class EventGridEvent(InternalEventGridEvent): - """Properties of an event published to an Event Grid topic using the EventGrid Schema. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param subject: Required. A resource path relative to the topic path. - :type subject: str - :param event_type: Required. The type of the event that occurred. - :type event_type: str - :param data: Required. Event data specific to the event type. - :type data: object - :param data_version: Required. The schema version of the data object. - If not provided, will be stamped with an empty value. - :type data_version: str - :keyword topic: The resource path of the event source. If not provided, Event Grid will - stamp onto the event. This is required when sending event(s) to a domain. - :paramtype topic: Optional[str] - :keyword metadata_version: The schema version of the event metadata. If provided, - must match Event Grid Schema exactly. If not provided, EventGrid will stamp onto event. - :paramtype metadata_version: Optional[str] - :keyword id: An identifier for the event. In not provided, a random UUID will be generated and used. - :paramtype id: Optional[str] - :keyword event_time: The time (in UTC) of the event. If not provided, - it will be the time (in UTC) the event was generated. - :paramtype event_time: Optional[~datetime.datetime] - :ivar subject: A resource path relative to the topic path. - :vartype subject: str - :ivar event_type: The type of the event that occurred. - :vartype event_type: str - :ivar data: Event data specific to the event type. - :vartype data: object - :ivar data_version: The schema version of the data object. - If not provided, will be stamped with an empty value. - :vartype data_version: str - :ivar topic: The resource path of the event source. If not provided, Event Grid will stamp onto the event. - :vartype topic: str - :ivar metadata_version: The schema version of the event metadata. If provided, must match Event Grid Schema exactly. - If not provided, EventGrid will stamp onto event. - :vartype metadata_version: str - :ivar id: An identifier for the event. In not provided, a random UUID will be generated and used. - :vartype id: str - :ivar event_time: The time (in UTC) of the event. If not provided, - it will be the time (in UTC) the event was generated. - :vartype event_time: ~datetime.datetime - """ - - _validation = { - "id": {"required": True}, - "subject": {"required": True}, - "data": {"required": True}, - "event_type": {"required": True}, - "event_time": {"required": True}, - "metadata_version": {"readonly": True}, - "data_version": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "topic": {"key": "topic", "type": "str"}, - "subject": {"key": "subject", "type": "str"}, - "data": {"key": "data", "type": "object"}, - "event_type": {"key": "eventType", "type": "str"}, - "event_time": {"key": "eventTime", "type": "iso-8601"}, - "metadata_version": {"key": "metadataVersion", "type": "str"}, - "data_version": {"key": "dataVersion", "type": "str"}, - } - - def __init__(self, subject: str, event_type: str, data: Any, data_version: str, **kwargs: Any) -> None: - kwargs.setdefault("id", uuid.uuid4()) - kwargs.setdefault("subject", subject) - kwargs.setdefault("event_type", event_type) - kwargs.setdefault("event_time", dt.datetime.now(dt.timezone.utc).isoformat()) - kwargs.setdefault("data", data) - kwargs.setdefault("data_version", data_version) - - super(EventGridEvent, self).__init__(**kwargs) - - def __repr__(self) -> str: - return "EventGridEvent(subject={}, event_type={}, id={}, event_time={})".format( - self.subject, self.event_type, self.id, self.event_time - )[:1024] - - @classmethod - def from_json(cls, event: Any) -> "EventGridEvent": - """ - Returns the deserialized EventGridEvent object when a json payload is provided. - :param event: The json string that should be converted into a EventGridEvent. This can also be - a storage QueueMessage, eventhub's EventData or ServiceBusMessage - :type event: object - :rtype: EventGridEvent - :return: An EventGridEvent object. - :raises ValueError: If the provided JSON is invalid. - - """ - dict_event = _get_json_content(event) - return cast(EventGridEvent, EventGridEvent.from_dict(dict_event)) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_policies.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_policies.py deleted file mode 100644 index d4f2dcfd5638a..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_policies.py +++ /dev/null @@ -1,48 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import json -from typing import TYPE_CHECKING -import logging -from azure.core.pipeline.policies import SansIOHTTPPolicy - -_LOGGER = logging.getLogger(__name__) - -if TYPE_CHECKING: - from azure.core.pipeline import PipelineRequest - - -class CloudEventDistributedTracingPolicy(SansIOHTTPPolicy): - """CloudEventDistributedTracingPolicy is a policy which adds distributed tracing information - to a batch of cloud events. It does so by copying the `traceparent` and `tracestate` properties - from the HTTP request into the individual events as extension properties. - This will only happen in the case where an event does not have a `traceparent` defined already. This - allows events to explicitly set a traceparent and tracestate which would be respected during "multi-hop - transmission". - See https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md - for more information on distributed tracing and cloud events. - """ - - _CONTENT_TYPE = "application/cloudevents-batch+json; charset=utf-8" - - def on_request(self, request): - # type: (PipelineRequest) -> None - try: - traceparent = request.http_request.headers["traceparent"] - tracestate = request.http_request.headers["tracestate"] - except KeyError: - return - - if ( - request.http_request.headers["content-type"] == CloudEventDistributedTracingPolicy._CONTENT_TYPE - and traceparent is not None - ): - body = json.loads(request.http_request.body) - for item in body: - if "traceparent" not in item and "tracestate" not in item: - item["traceparent"] = traceparent - item["tracestate"] = tracestate - - request.http_request.body = json.dumps(body) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py deleted file mode 100644 index f329e05dddedc..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py +++ /dev/null @@ -1,250 +0,0 @@ -# -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, cast, Dict, List, Any, Union, Optional - -from azure.core.tracing.decorator import distributed_trace -from azure.core.pipeline.policies import ( - RequestIdPolicy, - HeadersPolicy, - RedirectPolicy, - RetryPolicy, - ContentDecodePolicy, - CustomHookPolicy, - NetworkTraceLoggingPolicy, - ProxyPolicy, - DistributedTracingPolicy, - HttpLoggingPolicy, - UserAgentPolicy, -) -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceNotFoundError, - ResourceExistsError, - map_error, -) -from azure.core.messaging import CloudEvent - -from ._models import EventGridEvent -from ._helpers import ( - _get_authentication_policy, - _is_cloud_event, - _is_eventgrid_event_format, - _eventgrid_data_typecheck, - _build_request, - _cloud_event_to_generated, - _from_cncf_events, -) -from ._generated import ( - EventGridPublisherClient as EventGridPublisherClientImpl, -) -from ._policies import CloudEventDistributedTracingPolicy -from ._constants import DEFAULT_API_VERSION -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import ( - AzureKeyCredential, - AzureSasCredential, - TokenCredential, - ) - - from cloudevents.http.event import CloudEvent as CNCFCloudEvent - -SendType = Union[ - CloudEvent, - EventGridEvent, - Dict, - "CNCFCloudEvent", - List[CloudEvent], - List[EventGridEvent], - List[Dict], - List["CNCFCloudEvent"], -] - -ListEventType = Union[List[CloudEvent], List[EventGridEvent], List[Dict]] - - -class EventGridPublisherClient(object): # pylint: disable=client-accepts-api-version-keyword - """EventGridPublisherClient publishes events to an EventGrid topic or domain. - It can be used to publish either an EventGridEvent, a CloudEvent or a Custom Schema. - - :param str endpoint: The topic endpoint to send the events to. - :param credential: The credential object used for authentication which - implements SAS key authentication or SAS token authentication or a TokenCredential. - :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AzureSasCredential or - ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Will default to the most recent Api Version. Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :rtype: None - - .. admonition:: Example: - - .. literalinclude:: ../samples/basic/sync_samples/sample_authentication.py - :start-after: [START client_auth_with_key_cred] - :end-before: [END client_auth_with_key_cred] - :language: python - :dedent: 0 - :caption: Creating the EventGridPublisherClient with an endpoint and AzureKeyCredential. - - .. literalinclude:: ../samples/basic/sync_samples/sample_authentication.py - :start-after: [START client_auth_with_sas_cred] - :end-before: [END client_auth_with_sas_cred] - :language: python - :dedent: 0 - :caption: Creating the EventGridPublisherClient with an endpoint and AzureSasCredential. - """ - - def __init__( - self, - endpoint: str, - credential: Union["AzureKeyCredential", "AzureSasCredential", "TokenCredential"], - *, - api_version: Optional[str] = None, - **kwargs: Any - ) -> None: - self._endpoint = endpoint - self._client = EventGridPublisherClientImpl( - policies=EventGridPublisherClient._policies(credential, **kwargs), **kwargs - ) - self._api_version = api_version if api_version is not None else DEFAULT_API_VERSION - - @staticmethod - def _policies(credential, **kwargs): - # type: (Union[AzureKeyCredential, AzureSasCredential, TokenCredential], Any) -> List[Any] - auth_policy = _get_authentication_policy(credential) - sdk_moniker = "eventgrid/{}".format(VERSION) - policies = [ - RequestIdPolicy(**kwargs), - HeadersPolicy(**kwargs), - UserAgentPolicy(sdk_moniker=sdk_moniker, **kwargs), - ProxyPolicy(**kwargs), - ContentDecodePolicy(**kwargs), - RedirectPolicy(**kwargs), - RetryPolicy(**kwargs), - auth_policy, - CustomHookPolicy(**kwargs), - NetworkTraceLoggingPolicy(**kwargs), - DistributedTracingPolicy(**kwargs), - CloudEventDistributedTracingPolicy(), - HttpLoggingPolicy(**kwargs), - ] - return policies - - @distributed_trace - def send(self, events: SendType, *, channel_name: Optional[str] = None, **kwargs: Any) -> None: - """Sends events to a topic or a domain specified during the client initialization. - - A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted. - - .. admonition:: Example: - - .. literalinclude:: ../samples/sync_samples/sample_publish_eg_events_to_a_topic.py - :start-after: [START publish_eg_event_to_topic] - :end-before: [END publish_eg_event_to_topic] - :language: python - :dedent: 0 - :caption: Publishing an EventGridEvent. - - .. literalinclude:: ../samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py - :start-after: [START publish_cloud_event_to_topic] - :end-before: [END publish_cloud_event_to_topic] - :language: python - :dedent: 0 - :caption: Publishing a CloudEvent. - - Dict representation of respective serialized models is accepted as CloudEvent(s) or - EventGridEvent(s) apart from the strongly typed objects. - - .. admonition:: Example: - - .. literalinclude:: ../samples/sync_samples/sample_publish_eg_event_using_dict.py - :start-after: [START publish_eg_event_dict] - :end-before: [END publish_eg_event_dict] - :language: python - :dedent: 4 - :caption: Publishing a list of EventGridEvents using a dict-like representation. - - .. literalinclude:: ../samples/sync_samples/sample_publish_cloud_event_using_dict.py - :start-after: [START publish_cloud_event_dict] - :end-before: [END publish_cloud_event_dict] - :language: python - :dedent: 0 - :caption: Publishing a CloudEvent using a dict-like representation. - - When publishing a Custom Schema Event(s), dict-like representation is accepted. - Either a single dictionary or a list of dictionaries can be passed. - - .. admonition:: Example: - - .. literalinclude:: ../samples/sync_samples/sample_publish_custom_schema_to_a_topic.py - :start-after: [START publish_custom_schema] - :end-before: [END publish_custom_schema] - :language: python - :dedent: 4 - :caption: Publishing a Custom Schema event. - - **WARNING**: When sending a list of multiple events at one time, iterating over and sending each event - will not result in optimal performance. For best performance, it is highly recommended to send - a list of events. - - :param events: A single instance or a list of dictionaries/CloudEvent/EventGridEvent to be sent. - :type events: ~azure.core.messaging.CloudEvent or ~azure.eventgrid.EventGridEvent or dict or - List[~azure.core.messaging.CloudEvent] or List[~azure.eventgrid.EventGridEvent] or List[dict] - :keyword str content_type: The type of content to be used to send the events. - Has default value "application/json; charset=utf-8" for EventGridEvents, - with "cloudevents-batch+json" for CloudEvents - :keyword channel_name: Optional. Used to specify the name of event channel when publishing to partner. - :paramtype channel_name: str or None - namespaces with partner topic. For more details, visit - https://docs.microsoft.com/azure/event-grid/partner-events-overview - :rtype: None - """ - if not isinstance(events, list): - events = cast(ListEventType, [events]) - content_type = kwargs.pop("content_type", "application/json; charset=utf-8") - if isinstance(events[0], CloudEvent) or _is_cloud_event(events[0]): - try: - events = [_cloud_event_to_generated(e, **kwargs) for e in events] # pylint: disable=protected-access - except AttributeError: - ## this is either a dictionary or a CNCF cloud event - events = [_from_cncf_events(e) for e in events] - content_type = "application/cloudevents-batch+json; charset=utf-8" - elif isinstance(events[0], EventGridEvent) or _is_eventgrid_event_format(events[0]): - for event in events: - _eventgrid_data_typecheck(event) - response = self._client.send_request( # pylint: disable=protected-access - _build_request( - self._endpoint, content_type, events, channel_name=channel_name, api_version=self._api_version - ), - **kwargs - ) - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - } - if response.status_code != 200: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - def close(self): - # type: () -> None - """Close the :class:`~azure.eventgrid.EventGridPublisherClient` session.""" - return self._client.close() - - def __enter__(self): - # type: () -> EventGridPublisherClient - self._client.__enter__() # pylint:disable=no-member - return self - - def __exit__(self, *args): - # type: (*Any) -> None - self._client.__exit__(*args) # pylint:disable=no-member diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_signature_credential_policy.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_signature_credential_policy.py deleted file mode 100644 index ca6004fed4518..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_signature_credential_policy.py +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE.txt in the project root for -# license information. -# ------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline.policies import SansIOHTTPPolicy - -if TYPE_CHECKING: - from azure.core.credentials import AzureSasCredential - - -class EventGridSasCredentialPolicy(SansIOHTTPPolicy): - """Adds a token header for the provided credential. - :param credential: The credential used to authenticate requests. - :type credential: ~azure.core.credentials.AzureSasCredential - :param str name: The name of the token header used for the credential. - :raises: ValueError or TypeError - """ - - def __init__(self, credential, name, **kwargs): # pylint: disable=unused-argument - # type: (AzureSasCredential, str, Any) -> None - super(EventGridSasCredentialPolicy, self).__init__() - self._credential = credential - if not name: - raise ValueError("name can not be None or empty") - if not isinstance(name, str): - raise TypeError("name must be a string.") - self._name = name - - def on_request(self, request): - # Request must contain one of the following authorization signature: aeg-sas-token, aeg-sas-key - request.http_request.headers[self._name] = self._credential.signature diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_version.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_version.py deleted file mode 100644 index c9812c54f54c3..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_version.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -VERSION = "4.10.0" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/__init__.py deleted file mode 100644 index 0d2dce7aaea26..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -from ._publisher_client_async import EventGridPublisherClient - -__all__ = ["EventGridPublisherClient"] diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/_publisher_client_async.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/_publisher_client_async.py deleted file mode 100644 index ad718665ac014..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/aio/_publisher_client_async.py +++ /dev/null @@ -1,242 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Union, List, Dict, TYPE_CHECKING, cast, Optional -from azure.core.credentials import AzureKeyCredential, AzureSasCredential -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.messaging import CloudEvent -from azure.core.pipeline.policies import ( - RequestIdPolicy, - HeadersPolicy, - AsyncRedirectPolicy, - AsyncRetryPolicy, - ContentDecodePolicy, - CustomHookPolicy, - NetworkTraceLoggingPolicy, - ProxyPolicy, - DistributedTracingPolicy, - HttpLoggingPolicy, - UserAgentPolicy, - AsyncBearerTokenCredentialPolicy, -) -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceNotFoundError, - ResourceExistsError, - map_error, -) -from .._policies import CloudEventDistributedTracingPolicy -from .._models import EventGridEvent -from .._helpers import ( - _is_cloud_event, - _is_eventgrid_event_format, - _eventgrid_data_typecheck, - _build_request, - _cloud_event_to_generated, - _get_authentication_policy, - _from_cncf_events, -) -from .._constants import DEFAULT_API_VERSION -from .._generated.aio import EventGridPublisherClient as EventGridPublisherClientAsync -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - - from cloudevents.http.event import CloudEvent as CNCFCloudEvent - -SendType = Union[ - CloudEvent, - EventGridEvent, - Dict, - "CNCFCloudEvent", - List[CloudEvent], - List[EventGridEvent], - List[Dict], - List["CNCFCloudEvent"], -] - -ListEventType = Union[List[CloudEvent], List[EventGridEvent], List[Dict]] - - -class EventGridPublisherClient: # pylint: disable=client-accepts-api-version-keyword - """Asynchronous EventGridPublisherClient publishes events to an EventGrid topic or domain. - It can be used to publish either an EventGridEvent, a CloudEvent or a Custom Schema. - - :param str endpoint: The topic endpoint to send the events to. - :param credential: The credential object used for authentication which implements - SAS key authentication or SAS token authentication or an AsyncTokenCredential. - :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AzureSasCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Will default to the most recent Api Version. Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :rtype: None - - .. admonition:: Example: - - .. literalinclude:: ../samples/basic/async_samples/sample_authentication_async.py - :start-after: [START client_auth_with_key_cred_async] - :end-before: [END client_auth_with_key_cred_async] - :language: python - :dedent: 0 - :caption: Creating the EventGridPublisherClient with an endpoint and AzureKeyCredential. - - .. literalinclude:: ../samples/basic/async_samples/sample_authentication_async.py - :start-after: [START client_auth_with_sas_cred_async] - :end-before: [END client_auth_with_sas_cred_async] - :language: python - :dedent: 0 - :caption: Creating the EventGridPublisherClient with an endpoint and AzureSasCredential. - """ - - def __init__( - self, - endpoint: str, - credential: Union["AsyncTokenCredential", AzureKeyCredential, AzureSasCredential], - *, - api_version: Optional[str] = None, - **kwargs: Any - ) -> None: - self._client = EventGridPublisherClientAsync( - policies=EventGridPublisherClient._policies(credential, **kwargs), **kwargs - ) - self._endpoint = endpoint - self._api_version = api_version if api_version is not None else DEFAULT_API_VERSION - - @staticmethod - def _policies( - credential: Union[AzureKeyCredential, AzureSasCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> List[Any]: - auth_policy = _get_authentication_policy(credential, AsyncBearerTokenCredentialPolicy) - sdk_moniker = "eventgridpublisherclient/{}".format(VERSION) - policies = [ - RequestIdPolicy(**kwargs), - HeadersPolicy(**kwargs), - UserAgentPolicy(sdk_moniker=sdk_moniker, **kwargs), - ProxyPolicy(**kwargs), - ContentDecodePolicy(**kwargs), - AsyncRedirectPolicy(**kwargs), - AsyncRetryPolicy(**kwargs), - auth_policy, - CustomHookPolicy(**kwargs), - NetworkTraceLoggingPolicy(**kwargs), - DistributedTracingPolicy(**kwargs), - CloudEventDistributedTracingPolicy(), - HttpLoggingPolicy(**kwargs), - ] - return policies - - @distributed_trace_async - async def send(self, events: SendType, *, channel_name: Optional[str] = None, **kwargs: Any) -> None: - """Sends events to a topic or a domain specified during the client initialization. - - A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted. - - .. admonition:: Example: - - .. literalinclude:: ../samples/async_samples/sample_publish_eg_events_to_a_topic_async.py - :start-after: [START publish_eg_event_to_topic_async] - :end-before: [END publish_eg_event_to_topic_async] - :language: python - :dedent: 0 - :caption: Publishing an EventGridEvent. - - .. literalinclude:: ../samples/async_samples/sample_publish_events_using_cloud_events_1.0_schema_async.py - :start-after: [START publish_cloud_event_to_topic_async] - :end-before: [END publish_cloud_event_to_topic_async] - :language: python - :dedent: 0 - :caption: Publishing a CloudEvent. - - Dict representation of respective serialized models is accepted as CloudEvent(s) or - EventGridEvent(s) apart from the strongly typed objects. - - .. admonition:: Example: - - .. literalinclude:: ../samples/async_samples/sample_publish_eg_event_using_dict_async.py - :start-after: [START publish_eg_event_dict_async] - :end-before: [END publish_eg_event_dict_async] - :language: python - :dedent: 4 - :caption: Publishing a list of EventGridEvents using a dict-like representation. - - .. literalinclude:: ../samples/async_samples/sample_publish_cloud_event_using_dict_async.py - :start-after: [START publish_cloud_event_dict_async] - :end-before: [END publish_cloud_event_dict_async] - :language: python - :dedent: 4 - :caption: Publishing a CloudEvent using a dict-like representation. - - When publishing a Custom Schema Event(s), dict-like representation is accepted. - Either a single dictionary or a list of dictionaries can be passed. - - .. admonition:: Example: - - .. literalinclude:: ../samples/async_samples/sample_publish_custom_schema_to_a_topic_async.py - :start-after: [START publish_custom_schema_async] - :end-before: [END publish_custom_schema_async] - :language: python - :dedent: 4 - :caption: Publishing a Custom Schema event. - - **WARNING**: When sending a list of multiple events at one time, iterating over and sending each event - will not result in optimal performance. For best performance, it is highly recommended to send - a list of events. - - :param events: A single instance or a list of dictionaries/CloudEvent/EventGridEvent to be sent. - :type events: ~azure.core.messaging.CloudEvent or ~azure.eventgrid.EventGridEvent or dict or - List[~azure.core.messaging.CloudEvent] or List[~azure.eventgrid.EventGridEvent] or List[dict] - :keyword str content_type: The type of content to be used to send the events. - Has default value "application/json; charset=utf-8" for EventGridEvents, - with "cloudevents-batch+json" for CloudEvents - :keyword channel_name: Optional. Used to specify the name of event channel when publishing to partner - :paramtype channel_name: str or None - namespaces with partner topic. For more details, visit - https://docs.microsoft.com/azure/event-grid/partner-events-overview - :rtype: None - """ - if not isinstance(events, list): - events = cast(ListEventType, [events]) - content_type = kwargs.pop("content_type", "application/json; charset=utf-8") - if isinstance(events[0], CloudEvent) or _is_cloud_event(events[0]): - try: - events = [_cloud_event_to_generated(e, **kwargs) for e in events] # pylint: disable=protected-access - except AttributeError: - ## this is either a dictionary or a CNCF cloud event - events = [_from_cncf_events(e) for e in events] - content_type = "application/cloudevents-batch+json; charset=utf-8" - elif isinstance(events[0], EventGridEvent) or _is_eventgrid_event_format(events[0]): - for event in events: - _eventgrid_data_typecheck(event) - response = await self._client.send_request( # pylint: disable=protected-access - _build_request( - self._endpoint, content_type, events, channel_name=channel_name, api_version=self._api_version - ), - **kwargs - ) - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - } - if response.status_code != 200: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - async def __aenter__(self) -> "EventGridPublisherClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *args: "Any") -> None: - await self._client.__aexit__(*args) - - async def close(self) -> None: - """Close the :class:`~azure.eventgrid.aio.EventGridPublisherClient` session.""" - await self._client.__aexit__() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py index 5cf70733404de..6a6e1f38b17ec 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py @@ -1,10 +1,11 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except +# pylint: disable=protected-access, broad-except import copy import calendar @@ -19,6 +20,7 @@ import email.utils from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder +import xml.etree.ElementTree as ET from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -123,7 +125,7 @@ def _serialize_datetime(o, format: typing.Optional[str] = None): def _is_readonly(p): try: - return p._visibility == ["read"] # pylint: disable=protected-access + return p._visibility == ["read"] except AttributeError: return False @@ -286,6 +288,12 @@ def _deserialize_decimal(attr): return decimal.Decimal(str(attr)) +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -307,9 +315,11 @@ def _deserialize_decimal(attr): def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str if rf and rf._format: return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore def _get_type_alias_type(module_name: str, alias_name: str): @@ -441,6 +451,10 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m return float(o) if isinstance(o, enum.Enum): return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o try: # First try datetime.datetime return _serialize_datetime(o, format) @@ -471,11 +485,16 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return value if rf._is_model: return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) return _serialize(value, rf._format) class Model(_MyMutableMapping): _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ @@ -486,10 +505,58 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: for rest_field in self._attr_to_rest_field.values() if rest_field._default is not _UNSET } - if args: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) else: non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] if non_attr_kwargs: @@ -507,55 +574,70 @@ 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) -> 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 - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - if hasattr(mro_class, "__annotations__") # pylint: disable=no-member - for k, v in mro_class.__annotations__.items() # pylint: disable=no-member - } - for attr, rf in attr_to_rest_field.items(): - rf._module = cls.__module__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) # pylint: disable=no-value-for-parameter def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: - if hasattr(base, "__mapping__"): # pylint: disable=no-member - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional[str]: + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: for v in cls.__dict__.values(): - if ( - isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators - ): # pylint: disable=protected-access - return v._rest_name # pylint: disable=protected-access + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v return None @classmethod def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + if not hasattr(cls, "__mapping__"): return cls(data) discriminator = cls._get_discriminator(exist_discriminators) - exist_discriminators.append(discriminator) - mapped_cls = cls.__mapping__.get(data.get(discriminator), cls) # pyright: ignore # pylint: disable=no-member - if mapped_cls == cls: + if discriminator is None: return cls(data) - return mapped_cls._deserialize(data, exist_discriminators) # pylint: disable=protected-access + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + return mapped_cls._deserialize(data, exist_discriminators) def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: - """Return a dict that can be JSONify using json.dump. + """Return a dict that can be turned into json using json.dump. :keyword bool exclude_readonly: Whether to remove the readonly properties. :returns: A dict JSON compatible object @@ -563,6 +645,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing. """ result = {} + readonly_props = [] 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(): @@ -617,6 +700,8 @@ def _deserialize_dict( ): if obj is None: return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} @@ -637,6 +722,8 @@ def _deserialize_sequence( ): if obj is None: return obj + if isinstance(obj, ET.Element): + obj = list(obj) return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) @@ -647,12 +734,12 @@ def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.An ) -def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches annotation: typing.Any, module: typing.Optional[str], rf: typing.Optional["_RestField"] = None, ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation or annotation in [int, float]: + if not annotation: return None # is it a type alias? @@ -667,7 +754,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, except AttributeError: model_name = annotation if module is not None: - annotation = _get_model(module, model_name) + annotation = _get_model(module, model_name) # type: ignore try: if module and _is_model(annotation): @@ -727,7 +814,6 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, try: if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ # pyright: ignore @@ -762,12 +848,23 @@ def _deserialize_default( def _deserialize_with_callable( deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], value: typing.Any, -): +): # pylint: disable=too-many-return-statements try: if value is None or isinstance(value, _Null): return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None if deserializer is None: return value + if deserializer in [int, float, bool]: + return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: return deserializer(value) @@ -808,6 +905,7 @@ def __init__( default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, ): self._type = type self._rest_name_input = name @@ -818,6 +916,7 @@ def __init__( self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} @property def _class_type(self) -> typing.Any: @@ -868,6 +967,7 @@ def rest_field( default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, ) -> typing.Any: return _RestField( name=name, @@ -876,6 +976,7 @@ def rest_field( default=default, format=format, is_multipart_file_input=is_multipart_file_input, + xml=xml, ) @@ -883,5 +984,176 @@ def rest_discriminator( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, ) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True) + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/__init__.py deleted file mode 100644 index c716622cb7220..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._patch import EventGridPublisherClientOperationsMixin -from ._patch import EventGridConsumerClientOperationsMixin - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClientOperationsMixin", - "EventGridConsumerClientOperationsMixin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py deleted file mode 100644 index b2094313f8e6d..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py +++ /dev/null @@ -1,1268 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer -from .._validation import api_version_validation -from .._vendor import EventGridConsumerClientMixinABC, EventGridPublisherClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -_Unset: Any = object() - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_event_grid_publisher_send_request(topic_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: str = kwargs.pop("content_type") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}:publish" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_publisher_send_events_request( # pylint: disable=name-too-long - topic_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: str = kwargs.pop("content_type") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}:publish" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_consumer_receive_request( # pylint: disable=name-too-long - topic_name: str, - event_subscription_name: str, - *, - max_events: Optional[int] = None, - max_wait_time: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if max_events is not None: - _params["maxEvents"] = _SERIALIZER.query("max_events", max_events, "int") - if max_wait_time is not None: - _params["maxWaitTime"] = _SERIALIZER.query("max_wait_time", max_wait_time, "int") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_consumer_acknowledge_request( # pylint: disable=name-too-long - topic_name: str, event_subscription_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_consumer_release_request( # pylint: disable=name-too-long - topic_name: str, - event_subscription_name: str, - *, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if release_delay_in_seconds is not None: - _params["releaseDelayInSeconds"] = _SERIALIZER.query( - "release_delay_in_seconds", release_delay_in_seconds, "str" - ) - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_consumer_reject_request( - topic_name: str, event_subscription_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_event_grid_consumer_renew_locks_request( # pylint: disable=name-too-long - topic_name: str, event_subscription_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock" - path_format_arguments = { - "topicName": _SERIALIZER.url("topic_name", topic_name, "str"), - "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EventGridPublisherClientOperationsMixin(EventGridPublisherClientMixinABC): - - @distributed_trace - def _send( # pylint: disable=protected-access - self, topic_name: str, event: _models._models.CloudEvent, **kwargs: Any - ) -> _models._models.PublishResult: - # pylint: disable=line-too-long - """Publish a single Cloud Event to a namespace topic. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event: Single Cloud Event being published. Required. - :type event: ~azure.eventgrid.models._models.CloudEvent - :return: PublishResult. The PublishResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", _headers.pop("content-type", "application/cloudevents+json; charset=utf-8") - ) - cls: ClsType[_models._models.PublishResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _content = json.dumps(event, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_publisher_send_request( - topic_name=topic_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.PublishResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def _send_events( # pylint: disable=protected-access - self, topic_name: str, events: List[_models._models.CloudEvent], **kwargs: Any - ) -> _models._models.PublishResult: - # pylint: disable=line-too-long - """Publish a batch of Cloud Events to a namespace topic. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param events: Array of Cloud Events being published. Required. - :type events: list[~azure.eventgrid.models._models.CloudEvent] - :return: PublishResult. The PublishResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", _headers.pop("content-type", "application/cloudevents-batch+json; charset=utf-8") - ) - cls: ClsType[_models._models.PublishResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _content = json.dumps(events, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_publisher_send_events_request( - topic_name=topic_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.PublishResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class EventGridConsumerClientOperationsMixin(EventGridConsumerClientMixinABC): - - @distributed_trace - def _receive( # pylint: disable=protected-access - self, - topic_name: str, - event_subscription_name: str, - *, - max_events: Optional[int] = None, - max_wait_time: Optional[int] = None, - **kwargs: Any - ) -> _models._models.ReceiveResult: - # pylint: disable=line-too-long - """Receive a batch of Cloud Events from a subscription. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value - is 100 events. If not specified, the default value is 1. Default value is None. - :paramtype max_events: int - :keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in - seconds that the server approximately waits for the availability of an event and responds to - the request. If an event is available, the broker responds immediately to the client. Minimum - 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 - :return: ReceiveResult. The ReceiveResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models._models.ReceiveResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _request = build_event_grid_consumer_receive_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - max_events=max_events, - max_wait_time=max_wait_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.ReceiveResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - @overload - def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - @overload - def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - - @distributed_trace - def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.AcknowledgeResult: - """Acknowledge a batch of Cloud Events. The response will include the set of successfully - acknowledged lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully acknowledged events will no longer be available to be received by any - consumer. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_acknowledge_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AcknowledgeResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - def _release( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - def _release( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - def _release( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - - @distributed_trace - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - def _release( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - **kwargs: Any - ) -> _models.ReleaseResult: - """Release a batch of Cloud Events. The response will include the set of successfully released - lock tokens, along with other failed lock tokens with their corresponding error information. - Successfully released events can be received by consumers. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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: str or ~azure.eventgrid.models.ReleaseDelay - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_release_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - release_delay_in_seconds=release_delay_in_seconds, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ReleaseResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - @overload - def _reject( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - @overload - def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - - @distributed_trace - def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.RejectResult: - """Reject a batch of Cloud Events. The response will include the set of successfully rejected lock - tokens, along with other failed lock tokens with their corresponding error information. - Successfully rejected events will be dead-lettered and can no longer be received by a consumer. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_reject_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RejectResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - - @distributed_trace - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.RenewLocksResult: - """Renew locks for a batch of Cloud Events. The response will include the set of successfully - renewed lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully renewed locks will ensure that the associated event is only available - to the consumer that holds the renewed lock. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :return: RenewLocksResult. The RenewLocksResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RenewLocksResult - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RenewLocksResult] = kwargs.pop("cls", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_renew_locks_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RenewLocksResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py deleted file mode 100644 index 53855612b0762..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py +++ /dev/null @@ -1,349 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -import sys -from typing import ( - Any, - Callable, - Dict, - List, - Optional, - TypeVar, - Union, - TYPE_CHECKING, -) - -from azure.core.exceptions import ( - HttpResponseError, - ResourceNotFoundError, -) -from azure.core.messaging import CloudEvent -from azure.core.tracing.decorator import distributed_trace -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse - -from ._operations import ( - EventGridPublisherClientOperationsMixin as PublisherOperationsMixin, - EventGridConsumerClientOperationsMixin as ConsumerOperationsMixin, -) -from ..models._patch import ( - ReceiveDetails, -) -from .. import models as _models -from ..models._models import ( - CloudEvent as InternalCloudEvent, -) -from .._validation import api_version_validation - - -from .._legacy import EventGridEvent -from .._legacy._helpers import _from_cncf_events, _is_eventgrid_event_format, _is_cloud_event -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -if TYPE_CHECKING: - from cloudevents.http.event import CloudEvent as CNCFCloudEvent - - -class EventGridPublisherClientOperationsMixin(PublisherOperationsMixin): - - @distributed_trace - def send( - self, - events: Union[ - CloudEvent, - List[CloudEvent], - Dict[str, Any], - List[Dict[str, Any]], - "CNCFCloudEvent", - List["CNCFCloudEvent"], - EventGridEvent, - List[EventGridEvent], - ], - *, - channel_name: Optional[str] = None, - content_type: Optional[str] = None, - **kwargs: Any, - ) -> None: # pylint: disable=docstring-should-be-keyword, docstring-missing-param - """Send events to the Event Grid Service. - - :param events: The event(s) to send. If sending to an Event Grid Namespace, the dict, list of dicts, - or event(s) should be in the format of a CloudEvent. - :type events: CloudEvent or List[CloudEvent] or Dict[str, Any] or List[Dict[str, Any]] - or CNCFCloudEvent or List[CNCFCloudEvent] or EventGridEvent or List[EventGridEvent] - :keyword channel_name: The name of the channel to send the event to. Event Grid Basic Resource only. - :paramtype channel_name: str or None - :keyword content_type: The content type of the event. If not specified, the default value is - "application/cloudevents+json; charset=utf-8". - :paramtype content_type: str - - :return: None - :rtype: None - """ - if self._namespace and channel_name: - raise ValueError("Channel name is not supported for Event Grid Namespaces.") - - try: - if isinstance(events, dict): - events = CloudEvent.from_dict(events) - if isinstance(events, list) and isinstance(events[0], dict): - events = [CloudEvent.from_dict(e) for e in events] - except Exception: # pylint: disable=broad-except - pass - - if self._namespace: - kwargs["content_type"] = ( - content_type if content_type else "application/cloudevents-batch+json; charset=utf-8" - ) - if not isinstance(events, list): - events = [events] - - if isinstance(events[0], EventGridEvent) or _is_eventgrid_event_format(events[0]): - raise TypeError("EventGridEvent is not supported for Event Grid Namespaces.") - try: - # Try to send via namespace - self._publish(self._namespace, _serialize_events(events), **kwargs) - except Exception as exception: # pylint: disable=broad-except - self._http_response_error_handler(exception) - raise exception - else: - kwargs["content_type"] = content_type if content_type else "application/json; charset=utf-8" - try: - self._publish(events, channel_name=channel_name, **kwargs) - except Exception as exception: - self._http_response_error_handler(exception) - raise exception - - def _http_response_error_handler(self, exception): - if isinstance(exception, HttpResponseError): - if exception.status_code == 404: - raise ResourceNotFoundError( - "Resource not found. " - "For Event Grid Namespaces, please specify the namespace_topic name on the client. " - "For Event Grid Basic, do not specify the namespace_topic name." - ) from exception - raise exception - - -class EventGridConsumerClientOperationsMixin(ConsumerOperationsMixin): - - @distributed_trace - def receive( - self, - *, - max_events: Optional[int] = None, - max_wait_time: Optional[int] = None, - **kwargs: Any, - ) -> List[ReceiveDetails]: - """Receive Batch of Cloud Events from the Event Subscription. - - :keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value - is 100 events. The default is None, meaning it will receive one event if available. - :paramtype max_events: int - :keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in - seconds that the server approximately waits for the availability of an event and responds to - the request. If an event is available, the broker responds immediately to the client. Minimum - value is 10 seconds, while maximum value is 120 seconds. The default value is None, meaning it - will wait for 60 seconds. - :paramtype max_wait_time: int - :return: ReceiveDetails list of received events and their broker properties. - :rtype: list[~azure.eventgrid.models.ReceiveDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - detail_items = [] - received_result = self._receive( - self._namespace, - self._subscription, - max_events=max_events, - max_wait_time=max_wait_time, - **kwargs, - ) - for detail_item in received_result.details: - deserialized_cloud_event = CloudEvent.from_dict(detail_item.event) - detail_item.event = deserialized_cloud_event - detail_items.append( - ReceiveDetails( - broker_properties=detail_item.broker_properties, - event=detail_item.event, - ) - ) - return detail_items - - @distributed_trace - def acknowledge( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.AcknowledgeResult: - """Acknowledge a batch of Cloud Events. The response will include the set of successfully - acknowledged lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully acknowledged events will no longer be available to be received by any - consumer. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.AcknowledgeResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._acknowledge( - topic_name=self._namespace, - event_subscription_name=self._subscription, - lock_tokens=lock_tokens, - **kwargs, - ) - - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay"]}, - ) - def release( - self, - *, - lock_tokens: List[str], - release_delay: Optional[Union[int, _models.ReleaseDelay]] = None, - **kwargs: Any, - ) -> _models.ReleaseResult: - """Release a batch of Cloud Events. The response will include the set of successfully released - lock tokens, along with other failed lock tokens with their corresponding error information. - Successfully released events can be received by consumers. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :keyword release_delay: Release cloud events with the specified delay in seconds. - Known values are: 0, 10, 60, 600, and 3600. Default value is None, indicating no delay. - :paramtype release_delay: int or ~azure.eventgrid.models.ReleaseDelay - :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.ReleaseResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._release( - topic_name=self._namespace, - event_subscription_name=self._subscription, - lock_tokens=lock_tokens, - release_delay_in_seconds=release_delay, - **kwargs, - ) - - @distributed_trace - def reject( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.RejectResult: - """Reject a batch of Cloud Events. The response will include the set of successfully rejected lock - tokens, along with other failed lock tokens with their corresponding error information. - Successfully rejected events will be dead-lettered and can no longer be received by a consumer. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: RejectResult. The RejectResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RejectResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._reject( - topic_name=self._namespace, - event_subscription_name=self._subscription, - lock_tokens=lock_tokens, - **kwargs, - ) - - @distributed_trace - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={"2023-10-01-preview": ["api_version", "content_type", "accept"]}, - ) - def renew_locks( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.RenewLocksResult: - """Renew locks for a batch of Cloud Events. The response will include the set of successfully - renewed lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully renewed locks will ensure that the associated event is only available - to the consumer that holds the renewed lock. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: RenewLocksResult. The RenewLocksResult is compatible with - MutableMapping - :rtype: ~azure.eventgrid.models.RenewLocksResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._renew_locks( - topic_name=self._namespace, - event_subscription_name=self._subscription, - lock_tokens=lock_tokens, - **kwargs, - ) - - -def _serialize_events(events): - if isinstance(events[0], CloudEvent) or _is_cloud_event(events[0]): - # Try to serialize cloud events - try: - internal_body_list = [] - for item in events: - internal_body_list.append(_serialize_cloud_event(item)) - return internal_body_list - except AttributeError: - # Try to serialize CNCF Cloud Events - return [_from_cncf_events(e) for e in events] - else: - # Does not conform to format, try to send - return events - - -def _serialize_cloud_event(cloud_event): - data_kwargs = {} - - if isinstance(cloud_event.data, bytes): - data_kwargs["data_base64"] = cloud_event.data - else: - data_kwargs["data"] = cloud_event.data - - internal_event = InternalCloudEvent( - id=cloud_event.id, - source=cloud_event.source, - type=cloud_event.type, - specversion=cloud_event.specversion, - time=cloud_event.time, - dataschema=cloud_event.dataschema, - datacontenttype=cloud_event.datacontenttype, - subject=cloud_event.subject, - **data_kwargs, - ) - if cloud_event.extensions: - internal_event.update(cloud_event.extensions) - return internal_event - - -__all__: List[str] = [ - "EventGridPublisherClientOperationsMixin", - "EventGridConsumerClientOperationsMixin", -] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_patch.py index c7508657d16c8..f7dd32510333d 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_patch.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_patch.py @@ -3,152 +3,18 @@ # Licensed under the MIT License. # ------------------------------------ """Customize generated code here. + Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ +from typing import List -from typing import List, Union, Optional, Any -from azure.core.credentials import AzureKeyCredential, AzureSasCredential, TokenCredential - -from ._client import ( - EventGridPublisherClient as InternalEventGridPublisherClient, - EventGridConsumerClient as InternalEventGridConsumerClient, -) -from ._legacy import ( - EventGridPublisherClient as LegacyEventGridPublisherClient, - SystemEventNames, - EventGridEvent, - generate_sas, -) -from ._serialization import Deserializer, Serializer - - -DEFAULT_STANDARD_API_VERSION = "2024-06-01" -DEFAULT_BASIC_API_VERSION = "2018-01-01" - - -class EventGridPublisherClient(InternalEventGridPublisherClient): - """EventGridPublisherClient. - - Sends events to a basic topic, basic domain, or a namespace topic - specified during the client initialization. - - A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted. - If a list is provided, the list must contain only one type of event. - If dictionaries are provided and sending to a namespace topic, - the dictionary must follow the CloudEvent schema. - - :param endpoint: The endpoint of the Event Grid tier (basic or namespace), e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword namespace_topic: The name of the topic to publish events to. Required for Event Grid Namespaces. - Default value is None, which is used for Event Grid Basic. - :paramtype namespace_topic: str or None - :keyword api_version: The API version to use for this operation. Default value for Event Grid Namespace - is "2024-06-01", default value for Event Grid Basic is "2018-01-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, AzureSasCredential, "TokenCredential"], - *, - namespace_topic: Optional[str] = None, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - self._namespace = namespace_topic - self._credential = credential - - if not self._namespace: - self._client = LegacyEventGridPublisherClient( - endpoint, - credential, - api_version=api_version or DEFAULT_BASIC_API_VERSION, - ) # type:ignore[assignment] - self._publish = self._client.send # type:ignore[attr-defined] - else: - if isinstance(credential, AzureSasCredential): - raise TypeError("SAS token authentication is not supported for Event Grid Namespace.") - super().__init__( - endpoint=endpoint, - credential=credential, - api_version=api_version or DEFAULT_STANDARD_API_VERSION, - **kwargs, - ) - - self._publish = self._send_events - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def __repr__(self) -> str: - return ( - f"" - ) - - -class EventGridConsumerClient(InternalEventGridConsumerClient): - """EventGridConsumerClient. - - Consumes and manages events from a namespace topic - and event subscription specified during the client initialization. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword namespace_topic: The name of the topic to consume events from. Required. - :paramtype namespace_topic: str - :keyword subscription: The name of the subscription to consume events from. Required. - :paramtype subscription: str - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "TokenCredential"], - *, - namespace_topic: str, - subscription: str, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - self._namespace = namespace_topic - self._subscription = subscription - self._credential = credential - super().__init__( - endpoint=endpoint, credential=credential, api_version=api_version or DEFAULT_STANDARD_API_VERSION, **kwargs - ) - - def __repr__(self) -> str: - return f"" +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): """Do not remove from this file. + `patch_sdk` is a last resort escape hatch that allows you to do customizations you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__: List[str] = [ - "EventGridPublisherClient", - "EventGridConsumerClient", - "SystemEventNames", - "EventGridEvent", - "generate_sas", -] # Add all objects you want publicly available to users at this package level diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py index f0c6180722c89..e2ad518699086 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +145,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -406,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -424,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer(object): # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1361,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1414,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1718,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1741,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1832,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1847,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1875,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1885,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1908,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1922,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1937,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1974,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1994,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py deleted file mode 100644 index 752b2822f9d3e..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py +++ /dev/null @@ -1,50 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) 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/_vendor.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_vendor.py deleted file mode 100644 index e76c249bb07a7..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_vendor.py +++ /dev/null @@ -1,35 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EventGridConsumerClientConfiguration, EventGridPublisherClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -class EventGridPublisherClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: EventGridPublisherClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" - - -class EventGridConsumerClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: EventGridConsumerClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py index 5b0fb6c42327c..c8302cef558ba 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.21.1" +VERSION = "4.12.0b1" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/__init__.py deleted file mode 100644 index bcf16d1a1ec63..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._patch import EventGridPublisherClient -from ._patch import EventGridConsumerClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClient", - "EventGridConsumerClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_client.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_client.py deleted file mode 100644 index 07db6072d782c..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_client.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING, Union - -from azure.core import AsyncPipelineClient -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._serialization import Deserializer, Serializer -from ._configuration import EventGridConsumerClientConfiguration, EventGridPublisherClientConfiguration -from ._operations import EventGridConsumerClientOperationsMixin, EventGridPublisherClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class EventGridPublisherClient( - EventGridPublisherClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGridPublisherClient. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = EventGridPublisherClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "EventGridPublisherClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class EventGridConsumerClient( - EventGridConsumerClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """EventGridConsumerClient. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = EventGridConsumerClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "EventGridConsumerClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_configuration.py deleted file mode 100644 index db6bd48f5aa36..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_configuration.py +++ /dev/null @@ -1,136 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING, Union - -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import policies - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class EventGridPublisherClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EventGridPublisherClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") - - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.endpoint = endpoint - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://eventgrid.azure.net/.default"]) - kwargs.setdefault("sdk_moniker", "eventgrid/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _infer_policy(self, **kwargs): - if isinstance(self.credential, AzureKeyCredential): - return policies.AzureKeyCredentialPolicy( - self.credential, "Authorization", prefix="SharedAccessKey", **kwargs - ) - if hasattr(self.credential, "get_token"): - return policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) - raise TypeError(f"Unsupported credential: {self.credential}") - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = self._infer_policy(**kwargs) - - -class EventGridConsumerClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for EventGridConsumerClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") - - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.endpoint = endpoint - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://eventgrid.azure.net/.default"]) - kwargs.setdefault("sdk_moniker", "eventgrid/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _infer_policy(self, **kwargs): - if isinstance(self.credential, AzureKeyCredential): - return policies.AzureKeyCredentialPolicy( - self.credential, "Authorization", prefix="SharedAccessKey", **kwargs - ) - if hasattr(self.credential, "get_token"): - return policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) - raise TypeError(f"Unsupported credential: {self.credential}") - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/__init__.py deleted file mode 100644 index c716622cb7220..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._patch import EventGridPublisherClientOperationsMixin -from ._patch import EventGridConsumerClientOperationsMixin - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EventGridPublisherClientOperationsMixin", - "EventGridConsumerClientOperationsMixin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py deleted file mode 100644 index e10006e75b522..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py +++ /dev/null @@ -1,1055 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize -from ..._operations._operations import ( - build_event_grid_consumer_acknowledge_request, - build_event_grid_consumer_receive_request, - build_event_grid_consumer_reject_request, - build_event_grid_consumer_release_request, - build_event_grid_consumer_renew_locks_request, - build_event_grid_publisher_send_events_request, - build_event_grid_publisher_send_request, -) -from ..._validation import api_version_validation -from .._vendor import EventGridConsumerClientMixinABC, EventGridPublisherClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -_Unset: Any = object() - - -class EventGridPublisherClientOperationsMixin(EventGridPublisherClientMixinABC): - - @distributed_trace_async - async def _send( # pylint: disable=protected-access - self, topic_name: str, event: _models._models.CloudEvent, **kwargs: Any - ) -> _models._models.PublishResult: - # pylint: disable=line-too-long - """Publish a single Cloud Event to a namespace topic. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event: Single Cloud Event being published. Required. - :type event: ~azure.eventgrid.models._models.CloudEvent - :return: PublishResult. The PublishResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", _headers.pop("content-type", "application/cloudevents+json; charset=utf-8") - ) - cls: ClsType[_models._models.PublishResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _content = json.dumps(event, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_publisher_send_request( - topic_name=topic_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.PublishResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def _send_events( # pylint: disable=protected-access - self, topic_name: str, events: List[_models._models.CloudEvent], **kwargs: Any - ) -> _models._models.PublishResult: - # pylint: disable=line-too-long - """Publish a batch of Cloud Events to a namespace topic. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param events: Array of Cloud Events being published. Required. - :type events: list[~azure.eventgrid.models._models.CloudEvent] - :return: PublishResult. The PublishResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop( - "content_type", _headers.pop("content-type", "application/cloudevents-batch+json; charset=utf-8") - ) - cls: ClsType[_models._models.PublishResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _content = json.dumps(events, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_publisher_send_events_request( - topic_name=topic_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.PublishResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class EventGridConsumerClientOperationsMixin(EventGridConsumerClientMixinABC): - - @distributed_trace_async - async def _receive( # pylint: disable=protected-access - self, - topic_name: str, - event_subscription_name: str, - *, - max_events: Optional[int] = None, - max_wait_time: Optional[int] = None, - **kwargs: Any - ) -> _models._models.ReceiveResult: - # pylint: disable=line-too-long - """Receive a batch of Cloud Events from a subscription. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value - is 100 events. If not specified, the default value is 1. Default value is None. - :paramtype max_events: int - :keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in - seconds that the server approximately waits for the availability of an event and responds to - the request. If an event is available, the broker responds immediately to the client. Minimum - 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 - :return: ReceiveResult. The ReceiveResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models._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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models._models.ReceiveResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - - _request = build_event_grid_consumer_receive_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - max_events=max_events, - max_wait_time=max_wait_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize( - _models._models.ReceiveResult, response.json() # pylint: disable=protected-access - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - @overload - async def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - @overload - async def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AcknowledgeResult: ... - - @distributed_trace_async - async def _acknowledge( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.AcknowledgeResult: - """Acknowledge a batch of Cloud Events. The response will include the set of successfully - acknowledged lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully acknowledged events will no longer be available to be received by any - consumer. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_acknowledge_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AcknowledgeResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - async def _release( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - async def _release( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - @overload - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - async def _release( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ReleaseResult: ... - - @distributed_trace_async - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay_in_seconds"]}, - ) - async def _release( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - release_delay_in_seconds: Optional[Union[str, _models.ReleaseDelay]] = None, - **kwargs: Any - ) -> _models.ReleaseResult: - """Release a batch of Cloud Events. The response will include the set of successfully released - lock tokens, along with other failed lock tokens with their corresponding error information. - Successfully released events can be received by consumers. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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: str or ~azure.eventgrid.models.ReleaseDelay - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_release_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - release_delay_in_seconds=release_delay_in_seconds, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ReleaseResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - @overload - async def _reject( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - @overload - async def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RejectResult: ... - - @distributed_trace_async - async def _reject( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.RejectResult: - """Reject a batch of Cloud Events. The response will include the set of successfully rejected lock - tokens, along with other failed lock tokens with their corresponding error information. - Successfully rejected events will be dead-lettered and can no longer be received by a consumer. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :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. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _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", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_reject_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RejectResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - async def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - async def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - *, - lock_tokens: List[str], - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - @overload - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - async def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenewLocksResult: ... - - @distributed_trace_async - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={ - "2023-10-01-preview": ["api_version", "topic_name", "event_subscription_name", "content_type", "accept"] - }, - ) - async def _renew_locks( - self, - topic_name: str, - event_subscription_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - lock_tokens: List[str] = _Unset, - **kwargs: Any - ) -> _models.RenewLocksResult: - """Renew locks for a batch of Cloud Events. The response will include the set of successfully - renewed lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully renewed locks will ensure that the associated event is only available - to the consumer that holds the renewed lock. - - :param topic_name: Topic Name. Required. - :type topic_name: str - :param event_subscription_name: Event Subscription Name. Required. - :type event_subscription_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword lock_tokens: Array of lock tokens. Required. - :paramtype lock_tokens: list[str] - :return: RenewLocksResult. The RenewLocksResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RenewLocksResult - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "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: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RenewLocksResult] = kwargs.pop("cls", None) - - if body is _Unset: - if lock_tokens is _Unset: - raise TypeError("missing required argument: lock_tokens") - body = {"lockTokens": lock_tokens} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_event_grid_consumer_renew_locks_request( - topic_name=topic_name, - event_subscription_name=event_subscription_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RenewLocksResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py deleted file mode 100644 index cf4bcf026e85b..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py +++ /dev/null @@ -1,279 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List, Union, Any, Optional, Callable, Dict, TypeVar, TYPE_CHECKING -import sys -from azure.core.messaging import CloudEvent -from azure.core.exceptions import ( - HttpResponseError, - ResourceNotFoundError, -) -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, AsyncHttpResponse -from ...models._patch import ReceiveDetails -from ._operations import ( - EventGridPublisherClientOperationsMixin as PublisherOperationsMixin, - EventGridConsumerClientOperationsMixin as ConsumerOperationsMixin, -) -from ... import models as _models -from ..._validation import api_version_validation - -from ..._operations._patch import ( - _serialize_events, -) - -from ..._legacy import EventGridEvent -from ..._legacy._helpers import _is_eventgrid_event_format - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -if TYPE_CHECKING: - from cloudevents.http.event import CloudEvent as CNCFCloudEvent - - -class EventGridPublisherClientOperationsMixin(PublisherOperationsMixin): - - @distributed_trace_async - async def send( - self, - events: Union[ - CloudEvent, - List[CloudEvent], - Dict[str, Any], - List[Dict[str, Any]], - "CNCFCloudEvent", - List["CNCFCloudEvent"], - EventGridEvent, - List[EventGridEvent], - ], - *, - channel_name: Optional[str] = None, - content_type: Optional[str] = None, - **kwargs: Any, - ) -> None: # pylint: disable=docstring-should-be-keyword, docstring-missing-param - """Send events to the Event Grid Service. - - :param events: The event(s) to send. If sending to an Event Grid Namespace, the dict, list of dicts, - or event(s) should be in the format of a CloudEvent. - :type events: CloudEvent or List[CloudEvent] or Dict[str, Any] or List[Dict[str, Any]] - or CNCFCloudEvent or List[CNCFCloudEvent] or EventGridEvent or List[EventGridEvent] - :keyword channel_name: The name of the channel to send the event to. Event Grid Basic Resource only. - :paramtype channel_name: str or None - :keyword content_type: The content type of the event. If not specified, the default value is - "application/cloudevents+json; charset=utf-8". - :paramtype content_type: str - - :return: None - :rtype: None - """ - if self._namespace and channel_name: - raise ValueError("Channel name is not supported for Event Grid Namespaces.") - - # If a cloud event dict, convert to CloudEvent for serializing - try: - if isinstance(events, dict): - events = CloudEvent.from_dict(events) - if isinstance(events, list) and isinstance(events[0], dict): - events = [CloudEvent.from_dict(e) for e in events] - except Exception: # pylint: disable=broad-except - pass - - if self._namespace: - kwargs["content_type"] = ( - content_type if content_type else "application/cloudevents-batch+json; charset=utf-8" - ) - if not isinstance(events, list): - events = [events] - - if isinstance(events[0], EventGridEvent) or _is_eventgrid_event_format(events[0]): - raise TypeError("EventGridEvent is not supported for Event Grid Namespaces.") - try: - # Try to send via namespace - await self._publish(self._namespace, _serialize_events(events), **kwargs) - except Exception as exception: # pylint: disable=broad-except - self._http_response_error_handler(exception) - raise exception - else: - kwargs["content_type"] = content_type if content_type else "application/json; charset=utf-8" - try: - await self._publish(events, channel_name=channel_name, **kwargs) - except Exception as exception: - self._http_response_error_handler(exception) - raise exception - - def _http_response_error_handler(self, exception): - if isinstance(exception, HttpResponseError): - if exception.status_code == 404: - raise ResourceNotFoundError( - "Resource not found. " - "For Event Grid Namespaces, please specify the namespace_topic name on the client. " - "For Event Grid Basic, do not specify the namespace_topic name." - ) from exception - raise exception - - -class EventGridConsumerClientOperationsMixin(ConsumerOperationsMixin): - - @distributed_trace_async - async def receive( - self, - *, - max_events: Optional[int] = None, - max_wait_time: Optional[int] = None, - **kwargs: Any, - ) -> List[ReceiveDetails]: - """Receive Batch of Cloud Events from the Event Subscription. - - :keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value - is 100 events. The default is None, meaning it will receive one event if available. - :paramtype max_events: int - :keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in - seconds that the server approximately waits for the availability of an event and responds to - the request. If an event is available, the broker responds immediately to the client. Minimum - value is 10 seconds, while maximum value is 120 seconds. The default value is None, meaning it - will wait for 60 seconds. - :paramtype max_wait_time: int - :return: ReceiveDetails list of received events and their broker properties. - :rtype: list[~azure.eventgrid.models.ReceiveDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - detail_items = [] - receive_result = await self._receive( - self._namespace, - self._subscription, - max_events=max_events, - max_wait_time=max_wait_time, - **kwargs, - ) - for detail_item in receive_result.details: - deserialized_cloud_event = CloudEvent.from_dict(detail_item.event) - detail_item.event = deserialized_cloud_event - detail_items.append( - ReceiveDetails( - broker_properties=detail_item.broker_properties, - event=detail_item.event, - ) - ) - return detail_items - - @distributed_trace_async - async def acknowledge( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.AcknowledgeResult: - """Acknowledge a batch of Cloud Events. The response will include the set of successfully - acknowledged lock tokens, along with other failed lock tokens with their corresponding error - information. Successfully acknowledged events will no longer be available to be received by any - consumer. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.AcknowledgeResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._acknowledge(self._namespace, self._subscription, lock_tokens=lock_tokens, **kwargs) - - @distributed_trace_async - @api_version_validation( - params_added_on={"2023-10-01-preview": ["release_delay"]}, - ) - async def release( - self, - *, - lock_tokens: List[str], - release_delay: Optional[Union[int, _models.ReleaseDelay]] = None, - **kwargs: Any, - ) -> _models.ReleaseResult: - """Release a batch of Cloud Events. The response will include the set of successfully released - lock tokens, along with other failed lock tokens with their corresponding error information. - Successfully released events can be received by consumers. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :keyword release_delay: Release cloud events with the specified delay in seconds. - Known values are: 0, 10, 60, 600, and 3600. Default value is None, indicating no delay. - :paramtype release_delay: int or ~azure.eventgrid.models.ReleaseDelay - :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.ReleaseResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._release( - self._namespace, - self._subscription, - lock_tokens=lock_tokens, - release_delay_in_seconds=release_delay, - **kwargs, - ) - - @distributed_trace_async - async def reject( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.RejectResult: - """Reject a batch of Cloud Events. The response will include the set of successfully rejected lock - tokens, along with other failed lock tokens with their corresponding error information. - Successfully rejected events will be dead-lettered and can no longer be received by a consumer. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: RejectResult. The RejectResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RejectResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._reject(self._namespace, self._subscription, lock_tokens=lock_tokens, **kwargs) - - @distributed_trace_async - @api_version_validation( - method_added_on="2023-10-01-preview", - params_added_on={"2023-10-01-preview": ["api_version", "content_type", "accept"]}, - ) - async def renew_locks( - self, - *, - lock_tokens: List[str], - **kwargs: Any, - ) -> _models.RenewLocksResult: - """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 - information. - - :keyword lock_tokens: Array of lock tokens of Cloud Events. Required. - :paramtype lock_tokens: List[str] - :return: RenewLocksResult. The RenewLocksResult is compatible with - MutableMapping - :rtype: ~azure.eventgrid.models.RenewLocksResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._renew_locks(self._namespace, self._subscription, lock_tokens=lock_tokens, **kwargs) - - -__all__: List[str] = [ - "EventGridPublisherClientOperationsMixin", - "EventGridConsumerClientOperationsMixin", -] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_patch.py deleted file mode 100644 index 5081e0bc79e0a..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_patch.py +++ /dev/null @@ -1,149 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -from typing import List, Union, Any, TYPE_CHECKING, Optional -from azure.core.credentials import AzureKeyCredential, AzureSasCredential - - -from .._legacy.aio import EventGridPublisherClient as LegacyEventGridPublisherClient -from ._client import ( - EventGridPublisherClient as InternalEventGridPublisherClient, - EventGridConsumerClient as InternalEventGridConsumerClient, -) -from .._serialization import Deserializer, Serializer -from .._patch import ( - DEFAULT_BASIC_API_VERSION, - DEFAULT_STANDARD_API_VERSION, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class EventGridPublisherClient(InternalEventGridPublisherClient): - """EventGridPublisherClient. - - Sends events to a basic topic, basic domain, or a namespace topic - specified during the client initialization. - - A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted. - If a list is provided, the list must contain only one type of event. - If dictionaries are provided and sending to a namespace topic, - the dictionary must follow the CloudEvent schema. - - :param endpoint: The host name of the namespace, e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a AsyncTokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword namespace_topic: The name of the topic to publish events to. Required for Event Grid Namespaces. - Default value is None, which is used for Event Grid Basic. - :paramtype namespace_topic: str or None - :keyword api_version: The API version to use for this operation. Default value for Event Grid Namespace - is "2024-06-01", default value for Event Grid Basic is "2018-01-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, AzureSasCredential, "AsyncTokenCredential"], - *, - namespace_topic: Optional[str] = None, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - self._namespace = namespace_topic - self._credential = credential - - if not self._namespace: - self._client = LegacyEventGridPublisherClient( # type: ignore[assignment] - endpoint, credential, api_version=api_version or DEFAULT_BASIC_API_VERSION, **kwargs - ) - self._publish = self._client.send # type: ignore[attr-defined] - else: - if isinstance(credential, AzureSasCredential): - raise TypeError("SAS token authentication is not supported for Event Grid Namespace.") - - super().__init__( - endpoint=endpoint, - credential=credential, - api_version=api_version or DEFAULT_STANDARD_API_VERSION, - **kwargs, - ) - self._publish = self._send_events - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def __repr__(self) -> str: - return ( - f"" - ) - - -class EventGridConsumerClient(InternalEventGridConsumerClient): - """EventGridConsumerClient. - - Consumes and manages events from a namespace topic - and event subscription specified during the client initialization. - - :param endpoint: The endpoint of the Event Grid tier (basic or namespace), e.g. - namespaceName1.westus-1.eventgrid.azure.net. Required. - :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a AsyncTokenCredential type. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword namespace_topic: The name of the topic to consume events from. Required. - :paramtype namespace_topic: str - :keyword subscription: The name of the subscription to consume events from. Required. - :paramtype subscription: str - :keyword api_version: The API version to use for this operation. Default value is "2024-06-01". - Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "AsyncTokenCredential"], - *, - namespace_topic: str, - subscription: str, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - self._namespace = namespace_topic - self._subscription = subscription - self._credential = credential - super().__init__( - endpoint=endpoint, credential=credential, api_version=api_version or DEFAULT_STANDARD_API_VERSION, **kwargs - ) - - def __repr__(self) -> str: - return f"" - - -def patch_sdk(): - """Do not remove from this file. - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ - - -__all__: List[str] = [ - "EventGridConsumerClient", - "EventGridPublisherClient", -] # Add all objects you want publicly available to users at this package level diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_vendor.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_vendor.py deleted file mode 100644 index 4bf238ec554f4..0000000000000 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_vendor.py +++ /dev/null @@ -1,35 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import EventGridConsumerClientConfiguration, EventGridPublisherClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class EventGridPublisherClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: EventGridPublisherClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" - - -class EventGridConsumerClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: EventGridConsumerClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py index c687c94b6e9b3..6b6fba177e16f 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py @@ -5,25 +5,610 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models import AcknowledgeResult -from ._models import FailedLockToken -from ._models import RejectResult -from ._models import ReleaseResult -from ._models import RenewLocksResult +from typing import TYPE_CHECKING -from ._enums import ReleaseDelay +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AcsChatEventBaseProperties, + AcsChatEventInThreadBaseProperties, + AcsChatMessageDeletedEventData, + AcsChatMessageDeletedInThreadEventData, + AcsChatMessageEditedEventData, + AcsChatMessageEditedInThreadEventData, + AcsChatMessageEventBaseProperties, + AcsChatMessageEventInThreadBaseProperties, + AcsChatMessageReceivedEventData, + AcsChatMessageReceivedInThreadEventData, + AcsChatParticipantAddedToThreadEventData, + AcsChatParticipantAddedToThreadWithUserEventData, + AcsChatParticipantRemovedFromThreadEventData, + AcsChatParticipantRemovedFromThreadWithUserEventData, + AcsChatThreadCreatedEventData, + AcsChatThreadCreatedWithUserEventData, + AcsChatThreadDeletedEventData, + AcsChatThreadEventBaseProperties, + AcsChatThreadEventInThreadBaseProperties, + AcsChatThreadParticipantProperties, + AcsChatThreadPropertiesUpdatedEventData, + AcsChatThreadPropertiesUpdatedPerUserEventData, + AcsChatThreadWithUserDeletedEventData, + AcsEmailDeliveryReportReceivedEventData, + AcsEmailDeliveryReportStatusDetails, + AcsEmailEngagementTrackingReportReceivedEventData, + AcsIncomingCallCustomContext, + AcsIncomingCallEventData, + AcsMessageButtonContent, + AcsMessageChannelEventError, + AcsMessageContext, + AcsMessageDeliveryStatusUpdatedEventData, + AcsMessageEventData, + AcsMessageInteractiveButtonReplyContent, + AcsMessageInteractiveContent, + AcsMessageInteractiveListReplyContent, + AcsMessageMediaContent, + AcsMessageReceivedEventData, + AcsRecordingChunkInfoProperties, + AcsRecordingFileStatusUpdatedEventData, + AcsRecordingStorageInfoProperties, + AcsRouterChannelConfiguration, + AcsRouterCommunicationError, + AcsRouterEventData, + AcsRouterJobCancelledEventData, + AcsRouterJobClassificationFailedEventData, + AcsRouterJobClassifiedEventData, + AcsRouterJobClosedEventData, + AcsRouterJobCompletedEventData, + AcsRouterJobDeletedEventData, + AcsRouterJobEventData, + AcsRouterJobExceptionTriggeredEventData, + AcsRouterJobQueuedEventData, + AcsRouterJobReceivedEventData, + AcsRouterJobSchedulingFailedEventData, + AcsRouterJobUnassignedEventData, + AcsRouterJobWaitingForActivationEventData, + AcsRouterJobWorkerSelectorsExpiredEventData, + AcsRouterQueueDetails, + AcsRouterWorkerDeletedEventData, + AcsRouterWorkerDeregisteredEventData, + AcsRouterWorkerEventData, + AcsRouterWorkerOfferAcceptedEventData, + AcsRouterWorkerOfferDeclinedEventData, + AcsRouterWorkerOfferExpiredEventData, + AcsRouterWorkerOfferIssuedEventData, + AcsRouterWorkerOfferRevokedEventData, + AcsRouterWorkerRegisteredEventData, + AcsRouterWorkerSelector, + AcsRouterWorkerUpdatedEventData, + AcsSmsDeliveryAttemptProperties, + AcsSmsDeliveryReportReceivedEventData, + AcsSmsEventBaseProperties, + AcsSmsReceivedEventData, + AcsUserDisconnectedEventData, + ApiCenterApiDefinitionAddedEventData, + ApiCenterApiDefinitionUpdatedEventData, + ApiCenterApiSpecification, + ApiManagementApiCreatedEventData, + ApiManagementApiDeletedEventData, + ApiManagementApiReleaseCreatedEventData, + ApiManagementApiReleaseDeletedEventData, + ApiManagementApiReleaseUpdatedEventData, + ApiManagementApiUpdatedEventData, + ApiManagementGatewayApiAddedEventData, + ApiManagementGatewayApiRemovedEventData, + ApiManagementGatewayCertificateAuthorityCreatedEventData, + ApiManagementGatewayCertificateAuthorityDeletedEventData, + ApiManagementGatewayCertificateAuthorityUpdatedEventData, + ApiManagementGatewayCreatedEventData, + ApiManagementGatewayDeletedEventData, + ApiManagementGatewayHostnameConfigurationCreatedEventData, + ApiManagementGatewayHostnameConfigurationDeletedEventData, + ApiManagementGatewayHostnameConfigurationUpdatedEventData, + ApiManagementGatewayUpdatedEventData, + ApiManagementProductCreatedEventData, + ApiManagementProductDeletedEventData, + ApiManagementProductUpdatedEventData, + ApiManagementSubscriptionCreatedEventData, + ApiManagementSubscriptionDeletedEventData, + ApiManagementSubscriptionUpdatedEventData, + ApiManagementUserCreatedEventData, + ApiManagementUserDeletedEventData, + ApiManagementUserUpdatedEventData, + AppConfigurationKeyValueDeletedEventData, + AppConfigurationKeyValueModifiedEventData, + AppConfigurationSnapshotCreatedEventData, + AppConfigurationSnapshotEventData, + AppConfigurationSnapshotModifiedEventData, + AppEventTypeDetail, + AppServicePlanEventTypeDetail, + AvsClusterCreatedEventData, + AvsClusterDeletedEventData, + AvsClusterEventData, + AvsClusterFailedEventData, + AvsClusterUpdatedEventData, + AvsClusterUpdatingEventData, + AvsPrivateCloudEventData, + AvsPrivateCloudFailedEventData, + AvsPrivateCloudUpdatedEventData, + AvsPrivateCloudUpdatingEventData, + AvsScriptExecutionCancelledEventData, + AvsScriptExecutionEventData, + AvsScriptExecutionFailedEventData, + AvsScriptExecutionFinishedEventData, + AvsScriptExecutionStartedEventData, + CommunicationIdentifierModel, + CommunicationUserIdentifierModel, + ContainerRegistryArtifactEventData, + ContainerRegistryArtifactEventTarget, + ContainerRegistryChartDeletedEventData, + ContainerRegistryChartPushedEventData, + ContainerRegistryEventActor, + ContainerRegistryEventConnectedRegistry, + ContainerRegistryEventData, + ContainerRegistryEventRequest, + ContainerRegistryEventSource, + ContainerRegistryEventTarget, + ContainerRegistryImageDeletedEventData, + ContainerRegistryImagePushedEventData, + ContainerServiceClusterSupportEndedEventData, + ContainerServiceClusterSupportEndingEventData, + ContainerServiceClusterSupportEventData, + ContainerServiceNewKubernetesVersionAvailableEventData, + ContainerServiceNodePoolRollingEventData, + ContainerServiceNodePoolRollingFailedEventData, + ContainerServiceNodePoolRollingStartedEventData, + ContainerServiceNodePoolRollingSucceededEventData, + DataBoxCopyCompletedEventData, + DataBoxCopyStartedEventData, + DataBoxOrderCompletedEventData, + DeviceConnectionStateEventInfo, + DeviceConnectionStateEventProperties, + DeviceLifeCycleEventProperties, + DeviceTelemetryEventProperties, + DeviceTwinInfo, + DeviceTwinInfoProperties, + DeviceTwinInfoX509Thumbprint, + DeviceTwinMetadata, + DeviceTwinProperties, + EventGridMQTTClientCreatedOrUpdatedEventData, + EventGridMQTTClientDeletedEventData, + EventGridMQTTClientEventData, + EventGridMQTTClientSessionConnectedEventData, + EventGridMQTTClientSessionDisconnectedEventData, + EventHubCaptureFileCreatedEventData, + HealthcareDicomImageCreatedEventData, + HealthcareDicomImageDeletedEventData, + HealthcareDicomImageUpdatedEventData, + HealthcareFhirResourceCreatedEventData, + HealthcareFhirResourceDeletedEventData, + HealthcareFhirResourceUpdatedEventData, + IotHubDeviceConnectedEventData, + IotHubDeviceCreatedEventData, + IotHubDeviceDeletedEventData, + IotHubDeviceDisconnectedEventData, + IotHubDeviceTelemetryEventData, + KeyVaultAccessPolicyChangedEventData, + KeyVaultCertificateExpiredEventData, + KeyVaultCertificateNearExpiryEventData, + KeyVaultCertificateNewVersionCreatedEventData, + KeyVaultKeyExpiredEventData, + KeyVaultKeyNearExpiryEventData, + KeyVaultKeyNewVersionCreatedEventData, + KeyVaultSecretExpiredEventData, + KeyVaultSecretNearExpiryEventData, + KeyVaultSecretNewVersionCreatedEventData, + MachineLearningServicesDatasetDriftDetectedEventData, + MachineLearningServicesModelDeployedEventData, + MachineLearningServicesModelRegisteredEventData, + MachineLearningServicesRunCompletedEventData, + MachineLearningServicesRunStatusChangedEventData, + MapsGeofenceEnteredEventData, + MapsGeofenceEventProperties, + MapsGeofenceExitedEventData, + MapsGeofenceGeometry, + MapsGeofenceResultEventData, + MicrosoftTeamsAppIdentifierModel, + MicrosoftTeamsUserIdentifierModel, + PhoneNumberIdentifierModel, + PolicyInsightsPolicyStateChangedEventData, + PolicyInsightsPolicyStateCreatedEventData, + PolicyInsightsPolicyStateDeletedEventData, + RedisExportRDBCompletedEventData, + RedisImportRDBCompletedEventData, + RedisPatchingCompletedEventData, + RedisScalingCompletedEventData, + ResourceActionCancelEventData, + ResourceActionFailureEventData, + ResourceActionSuccessEventData, + ResourceAuthorization, + ResourceDeleteCancelEventData, + ResourceDeleteFailureEventData, + ResourceDeleteSuccessEventData, + ResourceHttpRequest, + ResourceNotificationsContainerServiceEventResourcesScheduledEventData, + ResourceNotificationsHealthResourcesAnnotatedEventData, + ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData, + ResourceNotificationsOperationalDetails, + ResourceNotificationsResourceDeletedDetails, + ResourceNotificationsResourceDeletedEventData, + ResourceNotificationsResourceManagementCreatedOrUpdatedEventData, + ResourceNotificationsResourceManagementDeletedEventData, + ResourceNotificationsResourceUpdatedDetails, + ResourceNotificationsResourceUpdatedEventData, + ResourceWriteCancelEventData, + ResourceWriteFailureEventData, + ResourceWriteSuccessEventData, + ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData, + ServiceBusActiveMessagesAvailableWithNoListenersEventData, + ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData, + ServiceBusDeadletterMessagesAvailableWithNoListenersEventData, + SignalRServiceClientConnectionConnectedEventData, + SignalRServiceClientConnectionDisconnectedEventData, + StorageAsyncOperationInitiatedEventData, + StorageBlobCreatedEventData, + StorageBlobDeletedEventData, + StorageBlobInventoryPolicyCompletedEventData, + StorageBlobRenamedEventData, + StorageBlobTierChangedEventData, + StorageDirectoryCreatedEventData, + StorageDirectoryDeletedEventData, + StorageDirectoryRenamedEventData, + StorageLifecyclePolicyActionSummaryDetail, + StorageLifecyclePolicyCompletedEventData, + StorageLifecyclePolicyRunSummary, + StorageTaskAssignmentCompletedEventData, + StorageTaskAssignmentQueuedEventData, + StorageTaskCompletedEventData, + StorageTaskQueuedEventData, + SubscriptionDeletedEventData, + SubscriptionValidationEventData, + SubscriptionValidationResponse, + WebAppServicePlanUpdatedEventData, + WebAppServicePlanUpdatedEventDataSku, + WebAppUpdatedEventData, + WebBackupOperationCompletedEventData, + WebBackupOperationFailedEventData, + WebBackupOperationStartedEventData, + WebRestoreOperationCompletedEventData, + WebRestoreOperationFailedEventData, + WebRestoreOperationStartedEventData, + WebSlotSwapCompletedEventData, + WebSlotSwapFailedEventData, + WebSlotSwapStartedEventData, + WebSlotSwapWithPreviewCancelledEventData, + WebSlotSwapWithPreviewStartedEventData, +) + +from ._enums import ( # type: ignore + AcsEmailDeliveryReportStatus, + AcsInteractiveReplyKind, + AcsMessageChannelKind, + AcsMessageDeliveryStatus, + AcsRouterJobStatus, + AcsRouterLabelOperator, + AcsRouterUpdatedWorkerProperty, + AcsRouterWorkerSelectorState, + AcsUserEngagement, + AppAction, + AppServicePlanAction, + AsyncStatus, + CommunicationCloudEnvironmentModel, + CommunicationIdentifierModelKind, + DataBoxStageName, + EventGridMQTTClientDisconnectionReason, + EventGridMQTTClientState, + HealthcareFhirResourceType, + RecordingChannelType, + RecordingContentType, + RecordingFormatType, + StampKind, + StorageBlobAccessTier, + StorageLifecycleCompletionStatus, + StorageTaskAssignmentCompletedStatus, + StorageTaskCompletedStatus, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AcknowledgeResult", - "FailedLockToken", - "RejectResult", - "ReleaseResult", - "RenewLocksResult", - "ReleaseDelay", + "AcsChatEventBaseProperties", + "AcsChatEventInThreadBaseProperties", + "AcsChatMessageDeletedEventData", + "AcsChatMessageDeletedInThreadEventData", + "AcsChatMessageEditedEventData", + "AcsChatMessageEditedInThreadEventData", + "AcsChatMessageEventBaseProperties", + "AcsChatMessageEventInThreadBaseProperties", + "AcsChatMessageReceivedEventData", + "AcsChatMessageReceivedInThreadEventData", + "AcsChatParticipantAddedToThreadEventData", + "AcsChatParticipantAddedToThreadWithUserEventData", + "AcsChatParticipantRemovedFromThreadEventData", + "AcsChatParticipantRemovedFromThreadWithUserEventData", + "AcsChatThreadCreatedEventData", + "AcsChatThreadCreatedWithUserEventData", + "AcsChatThreadDeletedEventData", + "AcsChatThreadEventBaseProperties", + "AcsChatThreadEventInThreadBaseProperties", + "AcsChatThreadParticipantProperties", + "AcsChatThreadPropertiesUpdatedEventData", + "AcsChatThreadPropertiesUpdatedPerUserEventData", + "AcsChatThreadWithUserDeletedEventData", + "AcsEmailDeliveryReportReceivedEventData", + "AcsEmailDeliveryReportStatusDetails", + "AcsEmailEngagementTrackingReportReceivedEventData", + "AcsIncomingCallCustomContext", + "AcsIncomingCallEventData", + "AcsMessageButtonContent", + "AcsMessageChannelEventError", + "AcsMessageContext", + "AcsMessageDeliveryStatusUpdatedEventData", + "AcsMessageEventData", + "AcsMessageInteractiveButtonReplyContent", + "AcsMessageInteractiveContent", + "AcsMessageInteractiveListReplyContent", + "AcsMessageMediaContent", + "AcsMessageReceivedEventData", + "AcsRecordingChunkInfoProperties", + "AcsRecordingFileStatusUpdatedEventData", + "AcsRecordingStorageInfoProperties", + "AcsRouterChannelConfiguration", + "AcsRouterCommunicationError", + "AcsRouterEventData", + "AcsRouterJobCancelledEventData", + "AcsRouterJobClassificationFailedEventData", + "AcsRouterJobClassifiedEventData", + "AcsRouterJobClosedEventData", + "AcsRouterJobCompletedEventData", + "AcsRouterJobDeletedEventData", + "AcsRouterJobEventData", + "AcsRouterJobExceptionTriggeredEventData", + "AcsRouterJobQueuedEventData", + "AcsRouterJobReceivedEventData", + "AcsRouterJobSchedulingFailedEventData", + "AcsRouterJobUnassignedEventData", + "AcsRouterJobWaitingForActivationEventData", + "AcsRouterJobWorkerSelectorsExpiredEventData", + "AcsRouterQueueDetails", + "AcsRouterWorkerDeletedEventData", + "AcsRouterWorkerDeregisteredEventData", + "AcsRouterWorkerEventData", + "AcsRouterWorkerOfferAcceptedEventData", + "AcsRouterWorkerOfferDeclinedEventData", + "AcsRouterWorkerOfferExpiredEventData", + "AcsRouterWorkerOfferIssuedEventData", + "AcsRouterWorkerOfferRevokedEventData", + "AcsRouterWorkerRegisteredEventData", + "AcsRouterWorkerSelector", + "AcsRouterWorkerUpdatedEventData", + "AcsSmsDeliveryAttemptProperties", + "AcsSmsDeliveryReportReceivedEventData", + "AcsSmsEventBaseProperties", + "AcsSmsReceivedEventData", + "AcsUserDisconnectedEventData", + "ApiCenterApiDefinitionAddedEventData", + "ApiCenterApiDefinitionUpdatedEventData", + "ApiCenterApiSpecification", + "ApiManagementApiCreatedEventData", + "ApiManagementApiDeletedEventData", + "ApiManagementApiReleaseCreatedEventData", + "ApiManagementApiReleaseDeletedEventData", + "ApiManagementApiReleaseUpdatedEventData", + "ApiManagementApiUpdatedEventData", + "ApiManagementGatewayApiAddedEventData", + "ApiManagementGatewayApiRemovedEventData", + "ApiManagementGatewayCertificateAuthorityCreatedEventData", + "ApiManagementGatewayCertificateAuthorityDeletedEventData", + "ApiManagementGatewayCertificateAuthorityUpdatedEventData", + "ApiManagementGatewayCreatedEventData", + "ApiManagementGatewayDeletedEventData", + "ApiManagementGatewayHostnameConfigurationCreatedEventData", + "ApiManagementGatewayHostnameConfigurationDeletedEventData", + "ApiManagementGatewayHostnameConfigurationUpdatedEventData", + "ApiManagementGatewayUpdatedEventData", + "ApiManagementProductCreatedEventData", + "ApiManagementProductDeletedEventData", + "ApiManagementProductUpdatedEventData", + "ApiManagementSubscriptionCreatedEventData", + "ApiManagementSubscriptionDeletedEventData", + "ApiManagementSubscriptionUpdatedEventData", + "ApiManagementUserCreatedEventData", + "ApiManagementUserDeletedEventData", + "ApiManagementUserUpdatedEventData", + "AppConfigurationKeyValueDeletedEventData", + "AppConfigurationKeyValueModifiedEventData", + "AppConfigurationSnapshotCreatedEventData", + "AppConfigurationSnapshotEventData", + "AppConfigurationSnapshotModifiedEventData", + "AppEventTypeDetail", + "AppServicePlanEventTypeDetail", + "AvsClusterCreatedEventData", + "AvsClusterDeletedEventData", + "AvsClusterEventData", + "AvsClusterFailedEventData", + "AvsClusterUpdatedEventData", + "AvsClusterUpdatingEventData", + "AvsPrivateCloudEventData", + "AvsPrivateCloudFailedEventData", + "AvsPrivateCloudUpdatedEventData", + "AvsPrivateCloudUpdatingEventData", + "AvsScriptExecutionCancelledEventData", + "AvsScriptExecutionEventData", + "AvsScriptExecutionFailedEventData", + "AvsScriptExecutionFinishedEventData", + "AvsScriptExecutionStartedEventData", + "CommunicationIdentifierModel", + "CommunicationUserIdentifierModel", + "ContainerRegistryArtifactEventData", + "ContainerRegistryArtifactEventTarget", + "ContainerRegistryChartDeletedEventData", + "ContainerRegistryChartPushedEventData", + "ContainerRegistryEventActor", + "ContainerRegistryEventConnectedRegistry", + "ContainerRegistryEventData", + "ContainerRegistryEventRequest", + "ContainerRegistryEventSource", + "ContainerRegistryEventTarget", + "ContainerRegistryImageDeletedEventData", + "ContainerRegistryImagePushedEventData", + "ContainerServiceClusterSupportEndedEventData", + "ContainerServiceClusterSupportEndingEventData", + "ContainerServiceClusterSupportEventData", + "ContainerServiceNewKubernetesVersionAvailableEventData", + "ContainerServiceNodePoolRollingEventData", + "ContainerServiceNodePoolRollingFailedEventData", + "ContainerServiceNodePoolRollingStartedEventData", + "ContainerServiceNodePoolRollingSucceededEventData", + "DataBoxCopyCompletedEventData", + "DataBoxCopyStartedEventData", + "DataBoxOrderCompletedEventData", + "DeviceConnectionStateEventInfo", + "DeviceConnectionStateEventProperties", + "DeviceLifeCycleEventProperties", + "DeviceTelemetryEventProperties", + "DeviceTwinInfo", + "DeviceTwinInfoProperties", + "DeviceTwinInfoX509Thumbprint", + "DeviceTwinMetadata", + "DeviceTwinProperties", + "EventGridMQTTClientCreatedOrUpdatedEventData", + "EventGridMQTTClientDeletedEventData", + "EventGridMQTTClientEventData", + "EventGridMQTTClientSessionConnectedEventData", + "EventGridMQTTClientSessionDisconnectedEventData", + "EventHubCaptureFileCreatedEventData", + "HealthcareDicomImageCreatedEventData", + "HealthcareDicomImageDeletedEventData", + "HealthcareDicomImageUpdatedEventData", + "HealthcareFhirResourceCreatedEventData", + "HealthcareFhirResourceDeletedEventData", + "HealthcareFhirResourceUpdatedEventData", + "IotHubDeviceConnectedEventData", + "IotHubDeviceCreatedEventData", + "IotHubDeviceDeletedEventData", + "IotHubDeviceDisconnectedEventData", + "IotHubDeviceTelemetryEventData", + "KeyVaultAccessPolicyChangedEventData", + "KeyVaultCertificateExpiredEventData", + "KeyVaultCertificateNearExpiryEventData", + "KeyVaultCertificateNewVersionCreatedEventData", + "KeyVaultKeyExpiredEventData", + "KeyVaultKeyNearExpiryEventData", + "KeyVaultKeyNewVersionCreatedEventData", + "KeyVaultSecretExpiredEventData", + "KeyVaultSecretNearExpiryEventData", + "KeyVaultSecretNewVersionCreatedEventData", + "MachineLearningServicesDatasetDriftDetectedEventData", + "MachineLearningServicesModelDeployedEventData", + "MachineLearningServicesModelRegisteredEventData", + "MachineLearningServicesRunCompletedEventData", + "MachineLearningServicesRunStatusChangedEventData", + "MapsGeofenceEnteredEventData", + "MapsGeofenceEventProperties", + "MapsGeofenceExitedEventData", + "MapsGeofenceGeometry", + "MapsGeofenceResultEventData", + "MicrosoftTeamsAppIdentifierModel", + "MicrosoftTeamsUserIdentifierModel", + "PhoneNumberIdentifierModel", + "PolicyInsightsPolicyStateChangedEventData", + "PolicyInsightsPolicyStateCreatedEventData", + "PolicyInsightsPolicyStateDeletedEventData", + "RedisExportRDBCompletedEventData", + "RedisImportRDBCompletedEventData", + "RedisPatchingCompletedEventData", + "RedisScalingCompletedEventData", + "ResourceActionCancelEventData", + "ResourceActionFailureEventData", + "ResourceActionSuccessEventData", + "ResourceAuthorization", + "ResourceDeleteCancelEventData", + "ResourceDeleteFailureEventData", + "ResourceDeleteSuccessEventData", + "ResourceHttpRequest", + "ResourceNotificationsContainerServiceEventResourcesScheduledEventData", + "ResourceNotificationsHealthResourcesAnnotatedEventData", + "ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData", + "ResourceNotificationsOperationalDetails", + "ResourceNotificationsResourceDeletedDetails", + "ResourceNotificationsResourceDeletedEventData", + "ResourceNotificationsResourceManagementCreatedOrUpdatedEventData", + "ResourceNotificationsResourceManagementDeletedEventData", + "ResourceNotificationsResourceUpdatedDetails", + "ResourceNotificationsResourceUpdatedEventData", + "ResourceWriteCancelEventData", + "ResourceWriteFailureEventData", + "ResourceWriteSuccessEventData", + "ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData", + "ServiceBusActiveMessagesAvailableWithNoListenersEventData", + "ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData", + "ServiceBusDeadletterMessagesAvailableWithNoListenersEventData", + "SignalRServiceClientConnectionConnectedEventData", + "SignalRServiceClientConnectionDisconnectedEventData", + "StorageAsyncOperationInitiatedEventData", + "StorageBlobCreatedEventData", + "StorageBlobDeletedEventData", + "StorageBlobInventoryPolicyCompletedEventData", + "StorageBlobRenamedEventData", + "StorageBlobTierChangedEventData", + "StorageDirectoryCreatedEventData", + "StorageDirectoryDeletedEventData", + "StorageDirectoryRenamedEventData", + "StorageLifecyclePolicyActionSummaryDetail", + "StorageLifecyclePolicyCompletedEventData", + "StorageLifecyclePolicyRunSummary", + "StorageTaskAssignmentCompletedEventData", + "StorageTaskAssignmentQueuedEventData", + "StorageTaskCompletedEventData", + "StorageTaskQueuedEventData", + "SubscriptionDeletedEventData", + "SubscriptionValidationEventData", + "SubscriptionValidationResponse", + "WebAppServicePlanUpdatedEventData", + "WebAppServicePlanUpdatedEventDataSku", + "WebAppUpdatedEventData", + "WebBackupOperationCompletedEventData", + "WebBackupOperationFailedEventData", + "WebBackupOperationStartedEventData", + "WebRestoreOperationCompletedEventData", + "WebRestoreOperationFailedEventData", + "WebRestoreOperationStartedEventData", + "WebSlotSwapCompletedEventData", + "WebSlotSwapFailedEventData", + "WebSlotSwapStartedEventData", + "WebSlotSwapWithPreviewCancelledEventData", + "WebSlotSwapWithPreviewStartedEventData", + "AcsEmailDeliveryReportStatus", + "AcsInteractiveReplyKind", + "AcsMessageChannelKind", + "AcsMessageDeliveryStatus", + "AcsRouterJobStatus", + "AcsRouterLabelOperator", + "AcsRouterUpdatedWorkerProperty", + "AcsRouterWorkerSelectorState", + "AcsUserEngagement", + "AppAction", + "AppServicePlanAction", + "AsyncStatus", + "CommunicationCloudEnvironmentModel", + "CommunicationIdentifierModelKind", + "DataBoxStageName", + "EventGridMQTTClientDisconnectionReason", + "EventGridMQTTClientState", + "HealthcareFhirResourceType", + "RecordingChannelType", + "RecordingContentType", + "RecordingFormatType", + "StampKind", + "StorageBlobAccessTier", + "StorageLifecycleCompletionStatus", + "StorageTaskAssignmentCompletedStatus", + "StorageTaskCompletedStatus", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_enums.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_enums.py index 207504715bf66..ab24a4205d491 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_enums.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_enums.py @@ -10,16 +10,659 @@ from azure.core import CaseInsensitiveEnumMeta -class ReleaseDelay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Supported delays for release operation.""" - - NO_DELAY = "0" - """Release the event after 0 seconds.""" - TEN_SECONDS = "10" - """Release the event after 10 seconds.""" - ONE_MINUTE = "60" - """Release the event after 60 seconds.""" - TEN_MINUTES = "600" - """Release the event after 600 seconds.""" - ONE_HOUR = "3600" - """Release the event after 3600 seconds.""" +class AcsEmailDeliveryReportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the email. Any value other than Delivered is considered failed.""" + + BOUNCED = "Bounced" + """Hard bounce detected while sending the email""" + DELIVERED = "Delivered" + """The email was delivered""" + FAILED = "Failed" + """The email failed to be delivered""" + FILTERED_SPAM = "FilteredSpam" + """The message was identified as spam and was rejected or blocked (not quarantined).""" + QUARANTINED = "Quarantined" + """The message was quarantined (as spam, bulk mail, or phishing). For more information, see + Quarantined email messages in EOP (EXCHANGE ONLINE PROTECTION).""" + SUPPRESSED = "Suppressed" + """The email was suppressed""" + + +class AcsInteractiveReplyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Interactive reply kind.""" + + BUTTON_REPLY = "buttonReply" + """Messaged interactive reply type is ButtonReply""" + LIST_REPLY = "listReply" + """Messaged interactive reply type is ListReply""" + UNKNOWN = "unknown" + """Messaged interactive reply type is Unknown""" + + +class AcsMessageChannelKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Message channel kind.""" + + WHATSAPP = "whatsapp" + """Updated message channel type is WhatsApp""" + + +class AcsMessageDeliveryStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Message delivery status.""" + + READ = "read" + """Read""" + DELIVERED = "delivered" + """Delivered""" + FAILED = "failed" + """Failed""" + SENT = "sent" + """Sent""" + WARNING = "warning" + """Warning""" + UNKNOWN = "unknown" + """Unknown""" + + +class AcsRouterJobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Acs Router Job Status.""" + + PENDING_CLASSIFICATION = "PendingClassification" + """Router Job Status Pending Classification""" + QUEUED = "Queued" + """Router Job Status Queued""" + ASSIGNED = "Assigned" + """Router Job Status Assigned""" + COMPLETED = "Completed" + """Router Job Status Completed""" + CLOSED = "Closed" + """Router Job Status Closed""" + CANCELLED = "Cancelled" + """Router Job Status Cancelled""" + CLASSIFICATION_FAILED = "ClassificationFailed" + """Router Job Status Classification Failed""" + CREATED = "Created" + """Router Job Status Created""" + PENDING_SCHEDULE = "PendingSchedule" + """Router Job Status Pending Schedule""" + SCHEDULED = "Scheduled" + """Router Job Status Scheduled""" + SCHEDULE_FAILED = "ScheduleFailed" + """Router Job Status Schedule Failed""" + WAITING_FOR_ACTIVATION = "WaitingForActivation" + """Router Job Status Waiting For Activation""" + + +class AcsRouterLabelOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Router Job Worker Selector Label Operator.""" + + EQUAL = "Equal" + """Router Label Operator Equal""" + NOT_EQUAL = "NotEqual" + """Router Label Operator Not Equal""" + GREATER = "Greater" + """Router Label Operator Greater""" + LESS = "Less" + """Router Label Operator Less""" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + """Router Label Operator Greater than or equal""" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + """Router Label Operator Less than or equal""" + + +class AcsRouterUpdatedWorkerProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Worker properties that can be updated.""" + + AVAILABLE_FOR_OFFERS = "AvailableForOffers" + """AvailableForOffers""" + TOTAL_CAPACITY = "TotalCapacity" + """TotalCapacity""" + QUEUE_ASSIGNMENTS = "QueueAssignments" + """QueueAssignments""" + LABELS = "Labels" + """Labels""" + TAGS = "Tags" + """Tags""" + CHANNEL_CONFIGURATIONS = "ChannelConfigurations" + """ChannelConfigurations""" + + +class AcsRouterWorkerSelectorState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Router Worker Selector State.""" + + ACTIVE = "active" + """Router Worker Selector State Active""" + EXPIRED = "expired" + """Router Worker Selector State Expired""" + + +class AcsUserEngagement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of engagement user have with email.""" + + VIEW = "view" + """View""" + CLICK = "click" + """Click""" + + +class AppAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of action of the operation.""" + + RESTARTED = "Restarted" + """Web app was restarted.""" + STOPPED = "Stopped" + """Web app was stopped.""" + CHANGED_APP_SETTINGS = "ChangedAppSettings" + """There was an operation to change app setting on the web app.""" + STARTED = "Started" + """The job has started.""" + COMPLETED = "Completed" + """The job has completed.""" + FAILED = "Failed" + """The job has failed to complete.""" + + +class AppServicePlanAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of action on the app service plan.""" + + UPDATED = "Updated" + """App Service plan is being updated.""" + + +class AsyncStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Asynchronous operation status of the operation on the app service plan.""" + + STARTED = "Started" + """Async operation has started.""" + COMPLETED = "Completed" + """Async operation has completed.""" + FAILED = "Failed" + """Async operation failed to complete.""" + + +class CommunicationCloudEnvironmentModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Communication cloud environment model.""" + + PUBLIC = "public" + """Public""" + DOD = "dod" + """Dod""" + GCCH = "gcch" + """Gcch""" + + +class CommunicationIdentifierModelKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Communication model identifier kind.""" + + UNKNOWN = "unknown" + """Unknown""" + COMMUNICATION_USER = "communicationUser" + """Communication User""" + PHONE_NUMBER = "phoneNumber" + """Phone Number""" + MICROSOFT_TEAMS_USER = "microsoftTeamsUser" + """Microsoft Teams User""" + + +class DataBoxStageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Schema of DataBox Stage Name enumeration.""" + + COPY_STARTED = "CopyStarted" + """Copy has started""" + COPY_COMPLETED = "CopyCompleted" + """Copy has completed""" + ORDER_COMPLETED = "OrderCompleted" + """Order has been completed""" + + +class EventGridMQTTClientDisconnectionReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """EventGrid MQTT Client Disconnection Reason.""" + + CLIENT_AUTHENTICATION_ERROR = "ClientAuthenticationError" + """The client got disconnected for any authentication reasons (for example, certificate expired, + client got disabled, or client configuration changed).""" + CLIENT_AUTHORIZATION_ERROR = "ClientAuthorizationError" + """The client got disconnected for any authorization reasons (for example, because of a change in + the configuration of topic spaces, permission bindings, or client groups).""" + CLIENT_ERROR = "ClientError" + """The client sent a bad request or used one of the unsupported features that resulted in a + connection termination by the service.""" + CLIENT_INITIATED_DISCONNECT = "ClientInitiatedDisconnect" + """The client initiated a graceful disconnect through a DISCONNECT packet for MQTT or a close + frame for MQTT over WebSocket.""" + CONNECTION_LOST = "ConnectionLost" + """The client-server connection is lost. (EXCHANGE ONLINE PROTECTION).""" + IP_FORBIDDEN = "IpForbidden" + """The client's IP address is blocked by IP filter or Private links configuration.""" + QUOTA_EXCEEDED = "QuotaExceeded" + """The client exceeded one or more of the throttling limits that resulted in a connection + termination by the service.""" + SERVER_ERROR = "ServerError" + """The connection got terminated due to an unexpected server error.""" + SERVER_INITIATED_DISCONNECT = "ServerInitiatedDisconnect" + """The server initiates a graceful disconnect for any operational reason.""" + SESSION_OVERFLOW = "SessionOverflow" + """The client's queue for unacknowledged QoS1 messages reached its limit, which resulted in a + connection termination by the server.""" + SESSION_TAKEN_OVER = "SessionTakenOver" + """The client reconnected with the same authentication name, which resulted in the termination of + the previous connection.""" + + +class EventGridMQTTClientState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """EventGrid MQTT Client State.""" + + ENABLED = "Enabled" + """Enabled""" + DISABLED = "Disabled" + """Disabled""" + + +class HealthcareFhirResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Schema of FHIR resource type enumeration.""" + + ACCOUNT = "Account" + """The FHIR resource type defined in STU3 and R4.""" + ACTIVITY_DEFINITION = "ActivityDefinition" + """The FHIR resource type defined in STU3 and R4.""" + ADVERSE_EVENT = "AdverseEvent" + """The FHIR resource type defined in STU3 and R4.""" + ALLERGY_INTOLERANCE = "AllergyIntolerance" + """The FHIR resource type defined in STU3 and R4.""" + APPOINTMENT = "Appointment" + """The FHIR resource type defined in STU3 and R4.""" + APPOINTMENT_RESPONSE = "AppointmentResponse" + """The FHIR resource type defined in STU3 and R4.""" + AUDIT_EVENT = "AuditEvent" + """The FHIR resource type defined in STU3 and R4.""" + BASIC = "Basic" + """The FHIR resource type defined in STU3 and R4.""" + BINARY = "Binary" + """The FHIR resource type defined in STU3 and R4.""" + BIOLOGICALLY_DERIVED_PRODUCT = "BiologicallyDerivedProduct" + """The FHIR resource type defined in R4.""" + BODY_SITE = "BodySite" + """The FHIR resource type defined in STU3.""" + BODY_STRUCTURE = "BodyStructure" + """The FHIR resource type defined in R4.""" + BUNDLE = "Bundle" + """The FHIR resource type defined in STU3 and R4.""" + CAPABILITY_STATEMENT = "CapabilityStatement" + """The FHIR resource type defined in STU3 and R4.""" + CARE_PLAN = "CarePlan" + """The FHIR resource type defined in STU3 and R4.""" + CARE_TEAM = "CareTeam" + """The FHIR resource type defined in STU3 and R4.""" + CATALOG_ENTRY = "CatalogEntry" + """The FHIR resource type defined in R4.""" + CHARGE_ITEM = "ChargeItem" + """The FHIR resource type defined in STU3 and R4.""" + CHARGE_ITEM_DEFINITION = "ChargeItemDefinition" + """The FHIR resource type defined in R4.""" + CLAIM = "Claim" + """The FHIR resource type defined in STU3 and R4.""" + CLAIM_RESPONSE = "ClaimResponse" + """The FHIR resource type defined in STU3 and R4.""" + CLINICAL_IMPRESSION = "ClinicalImpression" + """The FHIR resource type defined in STU3 and R4.""" + CODE_SYSTEM = "CodeSystem" + """The FHIR resource type defined in STU3 and R4.""" + COMMUNICATION = "Communication" + """The FHIR resource type defined in STU3 and R4.""" + COMMUNICATION_REQUEST = "CommunicationRequest" + """The FHIR resource type defined in STU3 and R4.""" + COMPARTMENT_DEFINITION = "CompartmentDefinition" + """The FHIR resource type defined in STU3 and R4.""" + COMPOSITION = "Composition" + """The FHIR resource type defined in STU3 and R4.""" + CONCEPT_MAP = "ConceptMap" + """The FHIR resource type defined in STU3 and R4.""" + CONDITION = "Condition" + """The FHIR resource type defined in STU3 and R4.""" + CONSENT = "Consent" + """The FHIR resource type defined in STU3 and R4.""" + CONTRACT = "Contract" + """The FHIR resource type defined in STU3 and R4.""" + COVERAGE = "Coverage" + """The FHIR resource type defined in STU3 and R4.""" + COVERAGE_ELIGIBILITY_REQUEST = "CoverageEligibilityRequest" + """The FHIR resource type defined in R4.""" + COVERAGE_ELIGIBILITY_RESPONSE = "CoverageEligibilityResponse" + """The FHIR resource type defined in R4.""" + DATA_ELEMENT = "DataElement" + """The FHIR resource type defined in STU3.""" + DETECTED_ISSUE = "DetectedIssue" + """The FHIR resource type defined in STU3 and R4.""" + DEVICE = "Device" + """The FHIR resource type defined in STU3 and R4.""" + DEVICE_COMPONENT = "DeviceComponent" + """The FHIR resource type defined in STU3.""" + DEVICE_DEFINITION = "DeviceDefinition" + """The FHIR resource type defined in R4.""" + DEVICE_METRIC = "DeviceMetric" + """The FHIR resource type defined in STU3 and R4.""" + DEVICE_REQUEST = "DeviceRequest" + """The FHIR resource type defined in STU3 and R4.""" + DEVICE_USE_STATEMENT = "DeviceUseStatement" + """The FHIR resource type defined in STU3 and R4.""" + DIAGNOSTIC_REPORT = "DiagnosticReport" + """The FHIR resource type defined in STU3 and R4.""" + DOCUMENT_MANIFEST = "DocumentManifest" + """The FHIR resource type defined in STU3 and R4.""" + DOCUMENT_REFERENCE = "DocumentReference" + """The FHIR resource type defined in STU3 and R4.""" + DOMAIN_RESOURCE = "DomainResource" + """The FHIR resource type defined in STU3 and R4.""" + EFFECT_EVIDENCE_SYNTHESIS = "EffectEvidenceSynthesis" + """The FHIR resource type defined in R4.""" + ELIGIBILITY_REQUEST = "EligibilityRequest" + """The FHIR resource type defined in STU3.""" + ELIGIBILITY_RESPONSE = "EligibilityResponse" + """The FHIR resource type defined in STU3.""" + ENCOUNTER = "Encounter" + """The FHIR resource type defined in STU3 and R4.""" + ENDPOINT = "Endpoint" + """The FHIR resource type defined in STU3 and R4.""" + ENROLLMENT_REQUEST = "EnrollmentRequest" + """The FHIR resource type defined in STU3 and R4.""" + ENROLLMENT_RESPONSE = "EnrollmentResponse" + """The FHIR resource type defined in STU3 and R4.""" + EPISODE_OF_CARE = "EpisodeOfCare" + """The FHIR resource type defined in STU3 and R4.""" + EVENT_DEFINITION = "EventDefinition" + """The FHIR resource type defined in R4.""" + EVIDENCE = "Evidence" + """The FHIR resource type defined in R4.""" + EVIDENCE_VARIABLE = "EvidenceVariable" + """The FHIR resource type defined in R4.""" + EXAMPLE_SCENARIO = "ExampleScenario" + """The FHIR resource type defined in R4.""" + EXPANSION_PROFILE = "ExpansionProfile" + """The FHIR resource type defined in STU3.""" + EXPLANATION_OF_BENEFIT = "ExplanationOfBenefit" + """The FHIR resource type defined in STU3 and R4.""" + FAMILY_MEMBER_HISTORY = "FamilyMemberHistory" + """The FHIR resource type defined in STU3 and R4.""" + FLAG = "Flag" + """The FHIR resource type defined in STU3 and R4.""" + GOAL = "Goal" + """The FHIR resource type defined in STU3 and R4.""" + GRAPH_DEFINITION = "GraphDefinition" + """The FHIR resource type defined in STU3 and R4.""" + GROUP = "Group" + """The FHIR resource type defined in STU3 and R4.""" + GUIDANCE_RESPONSE = "GuidanceResponse" + """The FHIR resource type defined in STU3 and R4.""" + HEALTHCARE_SERVICE = "HealthcareService" + """The FHIR resource type defined in STU3 and R4.""" + IMAGING_MANIFEST = "ImagingManifest" + """The FHIR resource type defined in STU3.""" + IMAGING_STUDY = "ImagingStudy" + """The FHIR resource type defined in STU3 and R4.""" + IMMUNIZATION = "Immunization" + """The FHIR resource type defined in STU3 and R4.""" + IMMUNIZATION_EVALUATION = "ImmunizationEvaluation" + """The FHIR resource type defined in R4.""" + IMMUNIZATION_RECOMMENDATION = "ImmunizationRecommendation" + """The FHIR resource type defined in STU3 and R4.""" + IMPLEMENTATION_GUIDE = "ImplementationGuide" + """The FHIR resource type defined in STU3 and R4.""" + INSURANCE_PLAN = "InsurancePlan" + """The FHIR resource type defined in R4.""" + INVOICE = "Invoice" + """The FHIR resource type defined in R4.""" + LIBRARY = "Library" + """The FHIR resource type defined in STU3 and R4.""" + LINKAGE = "Linkage" + """The FHIR resource type defined in STU3 and R4.""" + LIST = "List" + """The FHIR resource type defined in STU3 and R4.""" + LOCATION = "Location" + """The FHIR resource type defined in STU3 and R4.""" + MEASURE = "Measure" + """The FHIR resource type defined in STU3 and R4.""" + MEASURE_REPORT = "MeasureReport" + """The FHIR resource type defined in STU3 and R4.""" + MEDIA = "Media" + """The FHIR resource type defined in STU3 and R4.""" + MEDICATION = "Medication" + """The FHIR resource type defined in STU3 and R4.""" + MEDICATION_ADMINISTRATION = "MedicationAdministration" + """The FHIR resource type defined in STU3 and R4.""" + MEDICATION_DISPENSE = "MedicationDispense" + """The FHIR resource type defined in STU3 and R4.""" + MEDICATION_KNOWLEDGE = "MedicationKnowledge" + """The FHIR resource type defined in R4.""" + MEDICATION_REQUEST = "MedicationRequest" + """The FHIR resource type defined in STU3 and R4.""" + MEDICATION_STATEMENT = "MedicationStatement" + """The FHIR resource type defined in STU3 and R4.""" + MEDICINAL_PRODUCT = "MedicinalProduct" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_AUTHORIZATION = "MedicinalProductAuthorization" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_CONTRAINDICATION = "MedicinalProductContraindication" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_INDICATION = "MedicinalProductIndication" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_INGREDIENT = "MedicinalProductIngredient" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_INTERACTION = "MedicinalProductInteraction" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_MANUFACTURED = "MedicinalProductManufactured" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_PACKAGED = "MedicinalProductPackaged" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_PHARMACEUTICAL = "MedicinalProductPharmaceutical" + """The FHIR resource type defined in R4.""" + MEDICINAL_PRODUCT_UNDESIRABLE_EFFECT = "MedicinalProductUndesirableEffect" + """The FHIR resource type defined in R4.""" + MESSAGE_DEFINITION = "MessageDefinition" + """The FHIR resource type defined in STU3 and R4.""" + MESSAGE_HEADER = "MessageHeader" + """The FHIR resource type defined in STU3 and R4.""" + MOLECULAR_SEQUENCE = "MolecularSequence" + """The FHIR resource type defined in R4.""" + NAMING_SYSTEM = "NamingSystem" + """The FHIR resource type defined in STU3 and R4.""" + NUTRITION_ORDER = "NutritionOrder" + """The FHIR resource type defined in STU3 and R4.""" + OBSERVATION = "Observation" + """The FHIR resource type defined in STU3 and R4.""" + OBSERVATION_DEFINITION = "ObservationDefinition" + """The FHIR resource type defined in R4.""" + OPERATION_DEFINITION = "OperationDefinition" + """The FHIR resource type defined in STU3 and R4.""" + OPERATION_OUTCOME = "OperationOutcome" + """The FHIR resource type defined in STU3 and R4.""" + ORGANIZATION = "Organization" + """The FHIR resource type defined in STU3 and R4.""" + ORGANIZATION_AFFILIATION = "OrganizationAffiliation" + """The FHIR resource type defined in R4.""" + PARAMETERS = "Parameters" + """The FHIR resource type defined in STU3 and R4.""" + PATIENT = "Patient" + """The FHIR resource type defined in STU3 and R4.""" + PAYMENT_NOTICE = "PaymentNotice" + """The FHIR resource type defined in STU3 and R4.""" + PAYMENT_RECONCILIATION = "PaymentReconciliation" + """The FHIR resource type defined in STU3 and R4.""" + PERSON = "Person" + """The FHIR resource type defined in STU3 and R4.""" + PLAN_DEFINITION = "PlanDefinition" + """The FHIR resource type defined in STU3 and R4.""" + PRACTITIONER = "Practitioner" + """The FHIR resource type defined in STU3 and R4.""" + PRACTITIONER_ROLE = "PractitionerRole" + """The FHIR resource type defined in STU3 and R4.""" + PROCEDURE = "Procedure" + """The FHIR resource type defined in STU3 and R4.""" + PROCEDURE_REQUEST = "ProcedureRequest" + """The FHIR resource type defined in STU3.""" + PROCESS_REQUEST = "ProcessRequest" + """The FHIR resource type defined in STU3.""" + PROCESS_RESPONSE = "ProcessResponse" + """The FHIR resource type defined in STU3.""" + PROVENANCE = "Provenance" + """The FHIR resource type defined in STU3 and R4.""" + QUESTIONNAIRE = "Questionnaire" + """The FHIR resource type defined in STU3 and R4.""" + QUESTIONNAIRE_RESPONSE = "QuestionnaireResponse" + """The FHIR resource type defined in STU3 and R4.""" + REFERRAL_REQUEST = "ReferralRequest" + """The FHIR resource type defined in STU3.""" + RELATED_PERSON = "RelatedPerson" + """The FHIR resource type defined in STU3 and R4.""" + REQUEST_GROUP = "RequestGroup" + """The FHIR resource type defined in STU3 and R4.""" + RESEARCH_DEFINITION = "ResearchDefinition" + """The FHIR resource type defined in R4.""" + RESEARCH_ELEMENT_DEFINITION = "ResearchElementDefinition" + """The FHIR resource type defined in R4.""" + RESEARCH_STUDY = "ResearchStudy" + """The FHIR resource type defined in STU3 and R4.""" + RESEARCH_SUBJECT = "ResearchSubject" + """The FHIR resource type defined in STU3 and R4.""" + RESOURCE = "Resource" + """The FHIR resource type defined in STU3 and R4.""" + RISK_ASSESSMENT = "RiskAssessment" + """The FHIR resource type defined in STU3 and R4.""" + RISK_EVIDENCE_SYNTHESIS = "RiskEvidenceSynthesis" + """The FHIR resource type defined in R4.""" + SCHEDULE = "Schedule" + """The FHIR resource type defined in STU3 and R4.""" + SEARCH_PARAMETER = "SearchParameter" + """The FHIR resource type defined in STU3 and R4.""" + SEQUENCE = "Sequence" + """The FHIR resource type defined in STU3.""" + SERVICE_DEFINITION = "ServiceDefinition" + """The FHIR resource type defined in STU3.""" + SERVICE_REQUEST = "ServiceRequest" + """The FHIR resource type defined in R4.""" + SLOT = "Slot" + """The FHIR resource type defined in STU3 and R4.""" + SPECIMEN = "Specimen" + """The FHIR resource type defined in STU3 and R4.""" + SPECIMEN_DEFINITION = "SpecimenDefinition" + """The FHIR resource type defined in R4.""" + STRUCTURE_DEFINITION = "StructureDefinition" + """The FHIR resource type defined in STU3 and R4.""" + STRUCTURE_MAP = "StructureMap" + """The FHIR resource type defined in STU3 and R4.""" + SUBSCRIPTION = "Subscription" + """The FHIR resource type defined in STU3 and R4.""" + SUBSTANCE = "Substance" + """The FHIR resource type defined in STU3 and R4.""" + SUBSTANCE_NUCLEIC_ACID = "SubstanceNucleicAcid" + """The FHIR resource type defined in R4.""" + SUBSTANCE_POLYMER = "SubstancePolymer" + """The FHIR resource type defined in R4.""" + SUBSTANCE_PROTEIN = "SubstanceProtein" + """The FHIR resource type defined in R4.""" + SUBSTANCE_REFERENCE_INFORMATION = "SubstanceReferenceInformation" + """The FHIR resource type defined in R4.""" + SUBSTANCE_SOURCE_MATERIAL = "SubstanceSourceMaterial" + """The FHIR resource type defined in R4.""" + SUBSTANCE_SPECIFICATION = "SubstanceSpecification" + """The FHIR resource type defined in R4.""" + SUPPLY_DELIVERY = "SupplyDelivery" + """The FHIR resource type defined in STU3 and R4.""" + SUPPLY_REQUEST = "SupplyRequest" + """The FHIR resource type defined in STU3 and R4.""" + TASK = "Task" + """The FHIR resource type defined in STU3 and R4.""" + TERMINOLOGY_CAPABILITIES = "TerminologyCapabilities" + """The FHIR resource type defined in R4.""" + TEST_REPORT = "TestReport" + """The FHIR resource type defined in STU3 and R4.""" + TEST_SCRIPT = "TestScript" + """The FHIR resource type defined in STU3 and R4.""" + VALUE_SET = "ValueSet" + """The FHIR resource type defined in STU3 and R4.""" + VERIFICATION_RESULT = "VerificationResult" + """The FHIR resource type defined in R4.""" + VISION_PRESCRIPTION = "VisionPrescription" + """The FHIR resource type defined in STU3 and R4.""" + + +class RecordingChannelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recording channel type.""" + + MIXED = "Mixed" + """Mixed channel type""" + UNMIXED = "Unmixed" + """Unmixed channel type""" + + +class RecordingContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recording content type.""" + + AUDIO_VIDEO = "AudioVideo" + """AudioVideo content type""" + AUDIO = "Audio" + """Audio content type""" + + +class RecordingFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recording format type.""" + + WAV = "Wav" + """WAV format""" + MP3 = "Mp3" + """MP3 format""" + MP4 = "Mp4" + """MP4 format""" + + +class StampKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Kind of environment where app service plan is.""" + + PUBLIC = "Public" + """App Service Plan is running on a public stamp.""" + ASE_V1 = "AseV1" + """App Service Plan is running on an App Service Environment V1.""" + ASE_V2 = "AseV2" + """App Service Plan is running on an App Service Environment V2.""" + + +class StorageBlobAccessTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The access tier of the blob.""" + + HOT = "Hot" + """The blob is in access tier Hot""" + COOL = "Cool" + """The blob is in access tier Cool""" + COLD = "Cold" + """The blob is in access tier Cold""" + ARCHIVE = "Archive" + """The blob is in access tier Archive""" + DEFAULT = "Default" + """The blob is in access tier Default(Inferred)""" + + +class StorageLifecycleCompletionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status for a LCM policy.""" + + COMPLETED = "Completed" + """Completed""" + COMPLETED_WITH_ERROR = "CompletedWithError" + """CompletedWithError""" + INCOMPLETE = "Incomplete" + """Incomplete""" + + +class StorageTaskAssignmentCompletedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status for a storage task.""" + + SUCCEEDED = "Succeeded" + """Succeeded""" + FAILED = "Failed" + """Failed""" + + +class StorageTaskCompletedStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status for a storage task.""" + + SUCCEEDED = "Succeeded" + """Succeeded""" + FAILED = "Failed" + """Failed""" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py index a84b330a81127..7b0ed9e5be06f 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py @@ -1,370 +1,13319 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation import datetime -import sys -from typing import Any, List, Mapping, Optional, TYPE_CHECKING, overload +from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload from .. import _model_base from .._model_base import rest_field -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class AcknowledgeResult(_model_base.Model): - """The result of the Acknowledge operation. +class AcsChatEventBaseProperties(_model_base.Model): + """Schema of common properties of all chat events. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + """ + + recipient_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="recipientCommunicationIdentifier" + ) + """The communication identifier of the target user. Required.""" + transaction_id: Optional[str] = rest_field(name="transactionId") + """The transaction id will be used as co-relation vector.""" + thread_id: Optional[str] = rest_field(name="threadId") + """The chat thread id.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + - All required parameters must be populated in order to send to server. +class AcsChatEventInThreadBaseProperties(_model_base.Model): + """Schema of common properties of all thread-level chat events. - :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 acknowledged cloud - events. Required. - :vartype succeeded_lock_tokens: list[str] + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str """ - failed_lock_tokens: List["_models.FailedLockToken"] = rest_field(name="failedLockTokens") - """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.""" - succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") - """Array of lock tokens for the successfully acknowledged cloud events. Required.""" + transaction_id: Optional[str] = rest_field(name="transactionId") + """The transaction id will be used as co-relation vector.""" + thread_id: Optional[str] = rest_field(name="threadId") + """The chat thread id.""" @overload def __init__( self, *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): ... + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :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 + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BrokerProperties(_model_base.Model): - """Properties of the Event Broker operation. +class AcsChatMessageEventBaseProperties(AcsChatEventBaseProperties): + """Schema of common properties of all chat message events. - All required parameters must be populated in order to send to server. - :ivar lock_token: The token of the lock on the event. Required. - :vartype lock_token: str - :ivar delivery_count: The attempt count for delivering the event. Required. - :vartype delivery_count: int + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int """ - lock_token: str = rest_field(name="lockToken") - """The token of the lock on the event. Required.""" - delivery_count: int = rest_field(name="deliveryCount") - """The attempt count for delivering the event. Required.""" + message_id: Optional[str] = rest_field(name="messageId") + """The chat message id.""" + sender_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="senderCommunicationIdentifier" + ) + """The communication identifier of the sender. Required.""" + sender_display_name: Optional[str] = rest_field(name="senderDisplayName") + """The display name of the sender.""" + compose_time: datetime.datetime = rest_field(name="composeTime", format="rfc3339") + """The original compose time of the message. Required.""" + type: Optional[str] = rest_field() + """The type of the message.""" + version: Optional[int] = rest_field() + """The version of the message.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class CloudEvent(_model_base.Model): - """Properties of an event published to an Azure Messaging EventGrid Namespace topic using the - CloudEvent 1.0 Schema. +class AcsChatMessageDeletedEventData(AcsChatMessageEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageDeleted event. - All required parameters must be populated in order to send to server. - :ivar id: An identifier for the event. The combination of id and source must be unique for each - distinct event. Required. - :vartype id: str - :ivar source: Identifies the context in which an event happened. The combination of id and - source must be unique for each distinct event. Required. - :vartype source: str - :ivar data: Event data specific to the event type. - :vartype data: any - :ivar data_base64: Event data specific to the event type, encoded as a base64 string. - :vartype data_base64: bytes - :ivar type: Type of event related to the originating occurrence. Required. + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. :vartype type: str - :ivar time: The time (in UTC) the event was generated, in RFC3339 format. - :vartype time: ~datetime.datetime - :ivar specversion: The version of the CloudEvents specification which the event uses. Required. - :vartype specversion: str - :ivar dataschema: Identifies the schema that data adheres to. - :vartype dataschema: str - :ivar datacontenttype: Content type of data value. - :vartype datacontenttype: str - :ivar subject: This describes the subject of the event in the context of the event producer - (identified by source). - :vartype subject: str + :ivar version: The version of the message. + :vartype version: int + :ivar delete_time: The time at which the message was deleted. Required. + :vartype delete_time: ~datetime.datetime """ - id: str = rest_field() - """An identifier for the event. The combination of id and source must be unique for each distinct - event. Required.""" - source: str = rest_field() - """Identifies the context in which an event happened. The combination of id and source must be - unique for each distinct event. Required.""" - data: Optional[Any] = rest_field() - """Event data specific to the event type.""" - data_base64: Optional[bytes] = rest_field(format="base64") - """Event data specific to the event type, encoded as a base64 string.""" - type: str = rest_field() - """Type of event related to the originating occurrence. Required.""" - time: Optional[datetime.datetime] = rest_field(format="rfc3339") - """The time (in UTC) the event was generated, in RFC3339 format.""" - specversion: str = rest_field() - """The version of the CloudEvents specification which the event uses. Required.""" - dataschema: Optional[str] = rest_field() - """Identifies the schema that data adheres to.""" - datacontenttype: Optional[str] = rest_field() - """Content type of data value.""" - subject: Optional[str] = rest_field() - """This describes the subject of the event in the context of the event producer (identified by - source).""" - - -class Error(_model_base.Model): - """The error object. - - All required parameters must be populated in order to send to server. - - :ivar code: One of a server-defined set of error codes. Required. - :vartype code: str - :ivar message: A human-readable representation of the error. Required. - :vartype message: str - :ivar target: The target of the error. - :vartype target: str - :ivar details: An array of details about specific errors that led to this reported error. - :vartype details: list[~azure.eventgrid.models._models.Error] - :ivar innererror: An object containing more specific information than the current object about - the error. - :vartype innererror: ~azure.eventgrid.models._models.InnerError + delete_time: datetime.datetime = rest_field(name="deleteTime", format="rfc3339") + """The time at which the message was deleted. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + delete_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatMessageEventInThreadBaseProperties(AcsChatEventInThreadBaseProperties): # pylint: disable=name-too-long + """Schema of common properties of all thread-level chat message events. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int """ - code: str = rest_field() - """One of a server-defined set of error codes. Required.""" - message: str = rest_field() - """A human-readable representation of the error. Required.""" - target: Optional[str] = rest_field() - """The target of the error.""" - details: Optional[List["_models._models.Error"]] = rest_field() - """An array of details about specific errors that led to this reported error.""" - innererror: Optional["_models._models.InnerError"] = rest_field() - """An object containing more specific information than the current object about the error.""" + message_id: Optional[str] = rest_field(name="messageId") + """The chat message id.""" + sender_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="senderCommunicationIdentifier" + ) + """The communication identifier of the sender. Required.""" + sender_display_name: Optional[str] = rest_field(name="senderDisplayName") + """The display name of the sender.""" + compose_time: datetime.datetime = rest_field(name="composeTime", format="rfc3339") + """The original compose time of the message. Required.""" + type: Optional[str] = rest_field() + """The type of the message.""" + version: Optional[int] = rest_field() + """The version of the message.""" + + @overload + def __init__( + self, + *, + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class FailedLockToken(_model_base.Model): - """Failed LockToken information. +class AcsChatMessageDeletedInThreadEventData(AcsChatMessageEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageDeletedInThread event. - All required parameters must be populated in order to send to server. - :ivar lock_token: The lock token of an entry in the request. Required. - :vartype lock_token: str - :ivar error: Error information of the failed operation result for the lock token in the - request. Required. - :vartype error: ~azure.eventgrid.models._models.Error + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int + :ivar delete_time: The time at which the message was deleted. Required. + :vartype delete_time: ~datetime.datetime """ - lock_token: str = rest_field(name="lockToken") - """The lock token of an entry in the request. Required.""" - error: "_models._models.Error" = rest_field() - """Error information of the failed operation result for the lock token in the request. Required.""" + delete_time: datetime.datetime = rest_field(name="deleteTime", format="rfc3339") + """The time at which the message was deleted. Required.""" @overload def __init__( self, *, - lock_token: str, - error: "_models._models.Error", - ): ... + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + delete_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :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 + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class InnerError(_model_base.Model): - """An object containing more specific information about the error. As per Microsoft One API - guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. +class AcsChatMessageEditedEventData(AcsChatMessageEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageEdited event. - :ivar code: One of a server-defined set of error codes. - :vartype code: str - :ivar innererror: Inner error. - :vartype innererror: ~azure.eventgrid.models._models.InnerError + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int + :ivar message_body: The body of the chat message. + :vartype message_body: str + :ivar metadata: The chat message metadata. Required. + :vartype metadata: dict[str, str] + :ivar edit_time: The time at which the message was edited. Required. + :vartype edit_time: ~datetime.datetime """ - code: Optional[str] = rest_field() - """One of a server-defined set of error codes.""" - innererror: Optional["_models._models.InnerError"] = rest_field() - """Inner error.""" + message_body: Optional[str] = rest_field(name="messageBody") + """The body of the chat message.""" + metadata: Dict[str, str] = rest_field() + """The chat message metadata. Required.""" + edit_time: datetime.datetime = rest_field(name="editTime", format="rfc3339") + """The time at which the message was edited. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + metadata: Dict[str, str], + edit_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + message_body: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatMessageEditedInThreadEventData(AcsChatMessageEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageEditedInThread event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int + :ivar message_body: The body of the chat message. + :vartype message_body: str + :ivar metadata: The chat message metadata. Required. + :vartype metadata: dict[str, str] + :ivar edit_time: The time at which the message was edited. Required. + :vartype edit_time: ~datetime.datetime + """ + + message_body: Optional[str] = rest_field(name="messageBody") + """The body of the chat message.""" + metadata: Dict[str, str] = rest_field() + """The chat message metadata. Required.""" + edit_time: datetime.datetime = rest_field(name="editTime", format="rfc3339") + """The time at which the message was edited. Required.""" + + @overload + def __init__( + self, + *, + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + metadata: Dict[str, str], + edit_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + message_body: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatMessageReceivedEventData(AcsChatMessageEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageReceived event. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int + :ivar message_body: The body of the chat message. + :vartype message_body: str + :ivar metadata: The chat message metadata. Required. + :vartype metadata: dict[str, str] + """ + + message_body: Optional[str] = rest_field(name="messageBody") + """The body of the chat message.""" + metadata: Dict[str, str] = rest_field() + """The chat message metadata. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + metadata: Dict[str, str], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + message_body: Optional[str] = None, + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatMessageReceivedInThreadEventData(AcsChatMessageEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatMessageReceivedInThread event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar message_id: The chat message id. + :vartype message_id: str + :ivar sender_communication_identifier: The communication identifier of the sender. Required. + :vartype sender_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar sender_display_name: The display name of the sender. + :vartype sender_display_name: str + :ivar compose_time: The original compose time of the message. Required. + :vartype compose_time: ~datetime.datetime + :ivar type: The type of the message. + :vartype type: str + :ivar version: The version of the message. + :vartype version: int + :ivar message_body: The body of the chat message. + :vartype message_body: str + :ivar metadata: The chat message metadata. Required. + :vartype metadata: dict[str, str] + """ + + message_body: Optional[str] = rest_field(name="messageBody") + """The body of the chat message.""" + metadata: Dict[str, str] = rest_field() + """The chat message metadata. Required.""" + + @overload + def __init__( + self, + *, + sender_communication_identifier: "_models.CommunicationIdentifierModel", + compose_time: datetime.datetime, + metadata: Dict[str, str], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + message_id: Optional[str] = None, + sender_display_name: Optional[str] = None, + type: Optional[str] = None, + version: Optional[int] = None, + message_body: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatParticipantAddedToThreadEventData(AcsChatEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadParticipantAdded event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar time: The time at which the user was added to the thread. Required. + :vartype time: ~datetime.datetime + :ivar added_by_communication_identifier: The communication identifier of the user who added the + user. Required. + :vartype added_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar participant_added: The details of the user who was added. Required. + :vartype participant_added: ~azure.eventgrid.models.AcsChatThreadParticipantProperties + :ivar version: The version of the thread. + :vartype version: int + """ + + time: datetime.datetime = rest_field(format="rfc3339") + """The time at which the user was added to the thread. Required.""" + added_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="addedByCommunicationIdentifier" + ) + """The communication identifier of the user who added the user. Required.""" + participant_added: "_models.AcsChatThreadParticipantProperties" = rest_field(name="participantAdded") + """The details of the user who was added. Required.""" + version: Optional[int] = rest_field() + """The version of the thread.""" + + @overload + def __init__( + self, + *, + time: datetime.datetime, + added_by_communication_identifier: "_models.CommunicationIdentifierModel", + participant_added: "_models.AcsChatThreadParticipantProperties", + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadEventBaseProperties(AcsChatEventBaseProperties): + """Schema of common properties of all chat thread events. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + """ + + create_time: datetime.datetime = rest_field(name="createTime", format="rfc3339") + """The original creation time of the thread. Required.""" + version: Optional[int] = rest_field() + """The version of the thread.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class PublishResult(_model_base.Model): - """The result of the Publish operation.""" + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class ReceiveDetails(_model_base.Model): - """Receive operation details per Cloud Event. +class AcsChatParticipantAddedToThreadWithUserEventData( + AcsChatThreadEventBaseProperties +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatParticipantAddedToThreadWithUser event. - All required parameters must be populated in order to send to server. - :ivar broker_properties: The Event Broker details. Required. - :vartype broker_properties: ~azure.eventgrid.models._models.BrokerProperties - :ivar event: Cloud Event details. Required. - :vartype event: ~azure.eventgrid.models._models.CloudEvent + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar time: The time at which the user was added to the thread. Required. + :vartype time: ~datetime.datetime + :ivar added_by_communication_identifier: The communication identifier of the user who added the + user. Required. + :vartype added_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar participant_added: The details of the user who was added. Required. + :vartype participant_added: ~azure.eventgrid.models.AcsChatThreadParticipantProperties """ - broker_properties: "_models._models.BrokerProperties" = rest_field(name="brokerProperties") - """The Event Broker details. Required.""" - event: "_models._models.CloudEvent" = rest_field() - """Cloud Event details. Required.""" + time: datetime.datetime = rest_field(format="rfc3339") + """The time at which the user was added to the thread. Required.""" + added_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="addedByCommunicationIdentifier" + ) + """The communication identifier of the user who added the user. Required.""" + participant_added: "_models.AcsChatThreadParticipantProperties" = rest_field(name="participantAdded") + """The details of the user who was added. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + time: datetime.datetime, + added_by_communication_identifier: "_models.CommunicationIdentifierModel", + participant_added: "_models.AcsChatThreadParticipantProperties", + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class ReceiveResult(_model_base.Model): - """Details of the Receive operation response. +class AcsChatParticipantRemovedFromThreadEventData(AcsChatEventInThreadBaseProperties): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadParticipantRemoved event. - All required parameters must be populated in order to send to server. - :ivar details: Array of receive responses, one per cloud event. Required. - :vartype details: list[~azure.eventgrid.models._models.ReceiveDetails] + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar time: The time at which the user was removed to the thread. Required. + :vartype time: ~datetime.datetime + :ivar removed_by_communication_identifier: The communication identifier of the user who removed + the user. Required. + :vartype removed_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar participant_removed: The details of the user who was removed. Required. + :vartype participant_removed: ~azure.eventgrid.models.AcsChatThreadParticipantProperties + :ivar version: The version of the thread. + :vartype version: int """ - details: List["_models._models.ReceiveDetails"] = rest_field(name="value") - """Array of receive responses, one per cloud event. Required.""" + time: datetime.datetime = rest_field(format="rfc3339") + """The time at which the user was removed to the thread. Required.""" + removed_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="removedByCommunicationIdentifier" + ) + """The communication identifier of the user who removed the user. Required.""" + participant_removed: "_models.AcsChatThreadParticipantProperties" = rest_field(name="participantRemoved") + """The details of the user who was removed. Required.""" + version: Optional[int] = rest_field() + """The version of the thread.""" + + @overload + def __init__( + self, + *, + time: datetime.datetime, + removed_by_communication_identifier: "_models.CommunicationIdentifierModel", + participant_removed: "_models.AcsChatThreadParticipantProperties", + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class RejectResult(_model_base.Model): - """The result of the Reject operation. +class AcsChatParticipantRemovedFromThreadWithUserEventData( + AcsChatThreadEventBaseProperties +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser event. - 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 rejected cloud events. + :ivar recipient_communication_identifier: The communication identifier of the target user. Required. - :vartype succeeded_lock_tokens: list[str] + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar time: The time at which the user was removed to the thread. Required. + :vartype time: ~datetime.datetime + :ivar removed_by_communication_identifier: The communication identifier of the user who removed + the user. Required. + :vartype removed_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar participant_removed: The details of the user who was removed. Required. + :vartype participant_removed: ~azure.eventgrid.models.AcsChatThreadParticipantProperties """ - failed_lock_tokens: List["_models.FailedLockToken"] = rest_field(name="failedLockTokens") - """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.""" - succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") - """Array of lock tokens for the successfully rejected cloud events. Required.""" + time: datetime.datetime = rest_field(format="rfc3339") + """The time at which the user was removed to the thread. Required.""" + removed_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="removedByCommunicationIdentifier" + ) + """The communication identifier of the user who removed the user. Required.""" + participant_removed: "_models.AcsChatThreadParticipantProperties" = rest_field(name="participantRemoved") + """The details of the user who was removed. Required.""" @overload def __init__( self, *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): ... + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + time: datetime.datetime, + removed_by_communication_identifier: "_models.CommunicationIdentifierModel", + participant_removed: "_models.AcsChatThreadParticipantProperties", + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :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 + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ReleaseResult(_model_base.Model): - """The result of the Release operation. +class AcsChatThreadEventInThreadBaseProperties(AcsChatEventInThreadBaseProperties): + """Schema of common properties of all chat thread events. - 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 released cloud events. + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + """ + + create_time: datetime.datetime = rest_field(name="createTime", format="rfc3339") + """The original creation time of the thread. Required.""" + version: Optional[int] = rest_field() + """The version of the thread.""" + + @overload + def __init__( + self, + *, + create_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadCreatedEventData(AcsChatThreadEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadCreated event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar created_by_communication_identifier: The communication identifier of the user who created + the thread. Required. + :vartype created_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar properties: The thread properties. Required. + :vartype properties: dict[str, any] + :ivar metadata: The thread metadata. Required. + :vartype metadata: dict[str, str] + :ivar participants: The list of properties of participants who are part of the thread. Required. - :vartype succeeded_lock_tokens: list[str] + :vartype participants: list[~azure.eventgrid.models.AcsChatThreadParticipantProperties] + """ + + created_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="createdByCommunicationIdentifier" + ) + """The communication identifier of the user who created the thread. Required.""" + properties: Dict[str, Any] = rest_field() + """The thread properties. Required.""" + metadata: Dict[str, str] = rest_field() + """The thread metadata. Required.""" + participants: List["_models.AcsChatThreadParticipantProperties"] = rest_field() + """The list of properties of participants who are part of the thread. Required.""" + + @overload + def __init__( + self, + *, + create_time: datetime.datetime, + created_by_communication_identifier: "_models.CommunicationIdentifierModel", + properties: Dict[str, Any], + metadata: Dict[str, str], + participants: List["_models.AcsChatThreadParticipantProperties"], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadCreatedWithUserEventData(AcsChatThreadEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadCreatedWithUser event. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar created_by_communication_identifier: The communication identifier of the user who created + the thread. Required. + :vartype created_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar properties: The thread properties. Required. + :vartype properties: dict[str, any] + :ivar metadata: The thread metadata. Required. + :vartype metadata: dict[str, str] + :ivar participants: The list of properties of participants who are part of the thread. + Required. + :vartype participants: list[~azure.eventgrid.models.AcsChatThreadParticipantProperties] + """ + + created_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="createdByCommunicationIdentifier" + ) + """The communication identifier of the user who created the thread. Required.""" + properties: Dict[str, Any] = rest_field() + """The thread properties. Required.""" + metadata: Dict[str, str] = rest_field() + """The thread metadata. Required.""" + participants: List["_models.AcsChatThreadParticipantProperties"] = rest_field() + """The list of properties of participants who are part of the thread. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + created_by_communication_identifier: "_models.CommunicationIdentifierModel", + properties: Dict[str, Any], + metadata: Dict[str, str], + participants: List["_models.AcsChatThreadParticipantProperties"], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadDeletedEventData(AcsChatThreadEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadDeleted event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar deleted_by_communication_identifier: The communication identifier of the user who deleted + the thread. Required. + :vartype deleted_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar delete_time: The deletion time of the thread. Required. + :vartype delete_time: ~datetime.datetime + """ + + deleted_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="deletedByCommunicationIdentifier" + ) + """The communication identifier of the user who deleted the thread. Required.""" + delete_time: datetime.datetime = rest_field(name="deleteTime", format="rfc3339") + """The deletion time of the thread. Required.""" + + @overload + def __init__( + self, + *, + create_time: datetime.datetime, + deleted_by_communication_identifier: "_models.CommunicationIdentifierModel", + delete_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadParticipantProperties(_model_base.Model): + """Schema of the chat thread participant. + + + :ivar display_name: The name of the user. + :vartype display_name: str + :ivar participant_communication_identifier: The communication identifier of the user. Required. + :vartype participant_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar metadata: The metadata of the user. Required. + :vartype metadata: dict[str, str] + """ + + display_name: Optional[str] = rest_field(name="displayName") + """The name of the user.""" + participant_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="participantCommunicationIdentifier" + ) + """The communication identifier of the user. Required.""" + metadata: Dict[str, str] = rest_field() + """The metadata of the user. Required.""" + + @overload + def __init__( + self, + *, + participant_communication_identifier: "_models.CommunicationIdentifierModel", + metadata: Dict[str, str], + display_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadPropertiesUpdatedEventData(AcsChatThreadEventInThreadBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadPropertiesUpdated event. + + + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar edited_by_communication_identifier: The communication identifier of the user who updated + the thread properties. Required. + :vartype edited_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar edit_time: The time at which the properties of the thread were updated. Required. + :vartype edit_time: ~datetime.datetime + :ivar properties: The updated thread properties. Required. + :vartype properties: dict[str, any] + :ivar metadata: The thread metadata. Required. + :vartype metadata: dict[str, str] + """ + + edited_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="editedByCommunicationIdentifier" + ) + """The communication identifier of the user who updated the thread properties. Required.""" + edit_time: datetime.datetime = rest_field(name="editTime", format="rfc3339") + """The time at which the properties of the thread were updated. Required.""" + properties: Dict[str, Any] = rest_field() + """The updated thread properties. Required.""" + metadata: Dict[str, str] = rest_field() + """The thread metadata. Required.""" + + @overload + def __init__( + self, + *, + create_time: datetime.datetime, + edited_by_communication_identifier: "_models.CommunicationIdentifierModel", + edit_time: datetime.datetime, + properties: Dict[str, Any], + metadata: Dict[str, str], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadPropertiesUpdatedPerUserEventData(AcsChatThreadEventBaseProperties): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser event. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar edited_by_communication_identifier: The communication identifier of the user who updated + the thread properties. Required. + :vartype edited_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar edit_time: The time at which the properties of the thread were updated. Required. + :vartype edit_time: ~datetime.datetime + :ivar metadata: The thread metadata. Required. + :vartype metadata: dict[str, str] + :ivar properties: The updated thread properties. Required. + :vartype properties: dict[str, any] + """ + + edited_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="editedByCommunicationIdentifier" + ) + """The communication identifier of the user who updated the thread properties. Required.""" + edit_time: datetime.datetime = rest_field(name="editTime", format="rfc3339") + """The time at which the properties of the thread were updated. Required.""" + metadata: Dict[str, str] = rest_field() + """The thread metadata. Required.""" + properties: Dict[str, Any] = rest_field() + """The updated thread properties. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + edited_by_communication_identifier: "_models.CommunicationIdentifierModel", + edit_time: datetime.datetime, + metadata: Dict[str, str], + properties: Dict[str, Any], + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatThreadWithUserDeletedEventData(AcsChatThreadEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.ChatThreadWithUserDeleted event. + + + :ivar recipient_communication_identifier: The communication identifier of the target user. + Required. + :vartype recipient_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar transaction_id: The transaction id will be used as co-relation vector. + :vartype transaction_id: str + :ivar thread_id: The chat thread id. + :vartype thread_id: str + :ivar create_time: The original creation time of the thread. Required. + :vartype create_time: ~datetime.datetime + :ivar version: The version of the thread. + :vartype version: int + :ivar deleted_by_communication_identifier: The communication identifier of the user who deleted + the thread. Required. + :vartype deleted_by_communication_identifier: + ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar delete_time: The deletion time of the thread. Required. + :vartype delete_time: ~datetime.datetime + """ + + deleted_by_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="deletedByCommunicationIdentifier" + ) + """The communication identifier of the user who deleted the thread. Required.""" + delete_time: datetime.datetime = rest_field(name="deleteTime", format="rfc3339") + """The deletion time of the thread. Required.""" + + @overload + def __init__( + self, + *, + recipient_communication_identifier: "_models.CommunicationIdentifierModel", + create_time: datetime.datetime, + deleted_by_communication_identifier: "_models.CommunicationIdentifierModel", + delete_time: datetime.datetime, + transaction_id: Optional[str] = None, + thread_id: Optional[str] = None, + version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsEmailDeliveryReportReceivedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.EmailDeliveryReportReceived event. + + + :ivar sender: The Sender Email Address. + :vartype sender: str + :ivar recipient: The recipient Email Address. + :vartype recipient: str + :ivar message_id: The Id of the email been sent. + :vartype message_id: str + :ivar status: The status of the email. Any value other than Delivered is considered failed. + Required. Known values are: "Bounced", "Delivered", "Failed", "FilteredSpam", "Quarantined", + and "Suppressed". + :vartype status: str or ~azure.eventgrid.models.AcsEmailDeliveryReportStatus + :ivar delivery_status_details: Detailed information about the status if any. Required. + :vartype delivery_status_details: ~azure.eventgrid.models.AcsEmailDeliveryReportStatusDetails + :ivar delivery_attempt_timestamp: The time at which the email delivery report received + timestamp. Required. + :vartype delivery_attempt_timestamp: ~datetime.datetime + """ + + sender: Optional[str] = rest_field() + """The Sender Email Address.""" + recipient: Optional[str] = rest_field() + """The recipient Email Address.""" + message_id: Optional[str] = rest_field(name="messageId") + """The Id of the email been sent.""" + status: Union[str, "_models.AcsEmailDeliveryReportStatus"] = rest_field() + """The status of the email. Any value other than Delivered is considered failed. Required. Known + values are: \"Bounced\", \"Delivered\", \"Failed\", \"FilteredSpam\", \"Quarantined\", and + \"Suppressed\".""" + delivery_status_details: "_models.AcsEmailDeliveryReportStatusDetails" = rest_field(name="deliveryStatusDetails") + """Detailed information about the status if any. Required.""" + delivery_attempt_timestamp: datetime.datetime = rest_field(name="deliveryAttemptTimestamp", format="rfc3339") + """The time at which the email delivery report received timestamp. Required.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.AcsEmailDeliveryReportStatus"], + delivery_status_details: "_models.AcsEmailDeliveryReportStatusDetails", + delivery_attempt_timestamp: datetime.datetime, + sender: Optional[str] = None, + recipient: Optional[str] = None, + message_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsEmailDeliveryReportStatusDetails(_model_base.Model): + """Detailed information about the status if any. + + :ivar status_message: Detailed status message. + :vartype status_message: str + """ + + status_message: Optional[str] = rest_field(name="statusMessage") + """Detailed status message.""" + + @overload + def __init__( + self, + *, + status_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsEmailEngagementTrackingReportReceivedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.EmailEngagementTrackingReportReceived event. + + + :ivar sender: The Sender Email Address. + :vartype sender: str + :ivar recipient: The Recipient Email Address. + :vartype recipient: str + :ivar message_id: The Id of the email that has been sent. + :vartype message_id: str + :ivar user_action_timestamp: The time at which the user interacted with the email. Required. + :vartype user_action_timestamp: ~datetime.datetime + :ivar engagement_context: The context of the type of engagement user had with email. + :vartype engagement_context: str + :ivar user_agent: The user agent interacting with the email. + :vartype user_agent: str + :ivar engagement_type: The type of engagement user have with email. Required. Known values are: + "view" and "click". + :vartype engagement_type: str or ~azure.eventgrid.models.AcsUserEngagement + """ + + sender: Optional[str] = rest_field() + """The Sender Email Address.""" + recipient: Optional[str] = rest_field() + """The Recipient Email Address.""" + message_id: Optional[str] = rest_field(name="messageId") + """The Id of the email that has been sent.""" + user_action_timestamp: datetime.datetime = rest_field(name="userActionTimestamp", format="rfc3339") + """The time at which the user interacted with the email. Required.""" + engagement_context: Optional[str] = rest_field(name="engagementContext") + """The context of the type of engagement user had with email.""" + user_agent: Optional[str] = rest_field(name="userAgent") + """The user agent interacting with the email.""" + engagement_type: Union[str, "_models.AcsUserEngagement"] = rest_field(name="engagementType") + """The type of engagement user have with email. Required. Known values are: \"view\" and + \"click\".""" + + @overload + def __init__( + self, + *, + user_action_timestamp: datetime.datetime, + engagement_type: Union[str, "_models.AcsUserEngagement"], + sender: Optional[str] = None, + recipient: Optional[str] = None, + message_id: Optional[str] = None, + engagement_context: Optional[str] = None, + user_agent: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsIncomingCallCustomContext(_model_base.Model): + """Custom Context of Incoming Call. + + + :ivar sip_headers: Sip Headers for incoming call. Required. + :vartype sip_headers: dict[str, str] + :ivar voip_headers: Voip Headers for incoming call. Required. + :vartype voip_headers: dict[str, str] + """ + + sip_headers: Dict[str, str] = rest_field(name="sipHeaders") + """Sip Headers for incoming call. Required.""" + voip_headers: Dict[str, str] = rest_field(name="voipHeaders") + """Voip Headers for incoming call. Required.""" + + @overload + def __init__( + self, + *, + sip_headers: Dict[str, str], + voip_headers: Dict[str, str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsIncomingCallEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an Microsoft.Communication.IncomingCall + event. + + + :ivar to: The communication identifier of the target user. Required. + :vartype to: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar from_property: The communication identifier of the user who initiated the call. Required. + :vartype from_property: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar server_call_id: The Id of the server call. + :vartype server_call_id: str + :ivar caller_display_name: Display name of caller. + :vartype caller_display_name: str + :ivar custom_context: Custom Context of Incoming Call. Required. + :vartype custom_context: ~azure.eventgrid.models.AcsIncomingCallCustomContext + :ivar incoming_call_context: Signed incoming call context. + :vartype incoming_call_context: str + :ivar on_behalf_of_callee: The communication identifier of the user on behalf of whom the call + is made. + :vartype on_behalf_of_callee: ~azure.eventgrid.models.CommunicationIdentifierModel + :ivar correlation_id: CorrelationId (CallId). + :vartype correlation_id: str + """ + + to: "_models.CommunicationIdentifierModel" = rest_field() + """The communication identifier of the target user. Required.""" + from_property: "_models.CommunicationIdentifierModel" = rest_field(name="from") + """The communication identifier of the user who initiated the call. Required.""" + server_call_id: Optional[str] = rest_field(name="serverCallId") + """The Id of the server call.""" + caller_display_name: Optional[str] = rest_field(name="callerDisplayName") + """Display name of caller.""" + custom_context: "_models.AcsIncomingCallCustomContext" = rest_field(name="customContext") + """Custom Context of Incoming Call. Required.""" + incoming_call_context: Optional[str] = rest_field(name="incomingCallContext") + """Signed incoming call context.""" + on_behalf_of_callee: Optional["_models.CommunicationIdentifierModel"] = rest_field(name="onBehalfOfCallee") + """The communication identifier of the user on behalf of whom the call is made.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """CorrelationId (CallId).""" + + @overload + def __init__( + self, + *, + to: "_models.CommunicationIdentifierModel", + from_property: "_models.CommunicationIdentifierModel", + custom_context: "_models.AcsIncomingCallCustomContext", + server_call_id: Optional[str] = None, + caller_display_name: Optional[str] = None, + incoming_call_context: Optional[str] = None, + on_behalf_of_callee: Optional["_models.CommunicationIdentifierModel"] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageButtonContent(_model_base.Model): + """Message Button Content. + + :ivar text: The Text of the button. + :vartype text: str + :ivar payload: The Payload of the button which was clicked by the user, setup by the business. + :vartype payload: str + """ + + text: Optional[str] = rest_field() + """The Text of the button.""" + payload: Optional[str] = rest_field() + """The Payload of the button which was clicked by the user, setup by the business.""" + + @overload + def __init__( + self, + *, + text: Optional[str] = None, + payload: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageChannelEventError(_model_base.Model): + """Message Channel Event Error. + + :ivar channel_code: The channel error code. + :vartype channel_code: str + :ivar channel_message: The channel error message. + :vartype channel_message: str + """ + + channel_code: Optional[str] = rest_field(name="channelCode") + """The channel error code.""" + channel_message: Optional[str] = rest_field(name="channelMessage") + """The channel error message.""" + + @overload + def __init__( + self, + *, + channel_code: Optional[str] = None, + channel_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageContext(_model_base.Model): + """Message Context. + + :ivar from_property: The WhatsApp ID for the customer who replied to an inbound message. + :vartype from_property: str + :ivar id: The message ID for the sent message for an inbound reply. + :vartype id: str + """ + + from_property: Optional[str] = rest_field(name="from") + """The WhatsApp ID for the customer who replied to an inbound message.""" + id: Optional[str] = rest_field() + """The message ID for the sent message for an inbound reply.""" + + @overload + def __init__( + self, + *, + from_property: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageEventData(_model_base.Model): + """Schema of common properties of all chat thread events. + + + :ivar from_property: The message sender. + :vartype from_property: str + :ivar to: The message recipient. + :vartype to: str + :ivar received_time_stamp: The time message was received. Required. + :vartype received_time_stamp: ~datetime.datetime + :ivar error: The channel event error. Required. + :vartype error: ~azure.eventgrid.models.AcsMessageChannelEventError + """ + + from_property: Optional[str] = rest_field(name="from") + """The message sender.""" + to: Optional[str] = rest_field() + """The message recipient.""" + received_time_stamp: datetime.datetime = rest_field(name="receivedTimeStamp", format="rfc3339") + """The time message was received. Required.""" + error: "_models.AcsMessageChannelEventError" = rest_field() + """The channel event error. Required.""" + + @overload + def __init__( + self, + *, + received_time_stamp: datetime.datetime, + error: "_models.AcsMessageChannelEventError", + from_property: Optional[str] = None, + to: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageDeliveryStatusUpdatedEventData(AcsMessageEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated event. + + + :ivar from_property: The message sender. + :vartype from_property: str + :ivar to: The message recipient. + :vartype to: str + :ivar received_time_stamp: The time message was received. Required. + :vartype received_time_stamp: ~datetime.datetime + :ivar error: The channel event error. Required. + :vartype error: ~azure.eventgrid.models.AcsMessageChannelEventError + :ivar message_id: The message id. + :vartype message_id: str + :ivar status: The updated message status. Required. Known values are: "read", "delivered", + "failed", "sent", "warning", and "unknown". + :vartype status: str or ~azure.eventgrid.models.AcsMessageDeliveryStatus + :ivar channel_type: The updated message channel type. Required. "whatsapp" + :vartype channel_type: str or ~azure.eventgrid.models.AcsMessageChannelKind + """ + + message_id: Optional[str] = rest_field(name="messageId") + """The message id.""" + status: Union[str, "_models.AcsMessageDeliveryStatus"] = rest_field() + """The updated message status. Required. Known values are: \"read\", \"delivered\", \"failed\", + \"sent\", \"warning\", and \"unknown\".""" + channel_type: Union[str, "_models.AcsMessageChannelKind"] = rest_field(name="channelType") + """The updated message channel type. Required. \"whatsapp\"""" + + @overload + def __init__( + self, + *, + received_time_stamp: datetime.datetime, + error: "_models.AcsMessageChannelEventError", + status: Union[str, "_models.AcsMessageDeliveryStatus"], + channel_type: Union[str, "_models.AcsMessageChannelKind"], + from_property: Optional[str] = None, + to: Optional[str] = None, + message_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageInteractiveButtonReplyContent(_model_base.Model): + """Message Interactive button reply content for a user to business message. + + :ivar id: The ID of the button. + :vartype id: str + :ivar title: The title of the button. + :vartype title: str + """ + + id: Optional[str] = rest_field() + """The ID of the button.""" + title: Optional[str] = rest_field() + """The title of the button.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + title: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageInteractiveContent(_model_base.Model): + """Message Interactive Content. + + + :ivar type: The Message interactive reply type. Required. Known values are: "buttonReply", + "listReply", and "unknown". + :vartype type: str or ~azure.eventgrid.models.AcsInteractiveReplyKind + :ivar button_reply: The Message Sent when a customer clicks a button. Required. + :vartype button_reply: ~azure.eventgrid.models.AcsMessageInteractiveButtonReplyContent + :ivar list_reply: The Message Sent when a customer selects an item from a list. Required. + :vartype list_reply: ~azure.eventgrid.models.AcsMessageInteractiveListReplyContent + """ + + type: Union[str, "_models.AcsInteractiveReplyKind"] = rest_field() + """The Message interactive reply type. Required. Known values are: \"buttonReply\", \"listReply\", + and \"unknown\".""" + button_reply: "_models.AcsMessageInteractiveButtonReplyContent" = rest_field(name="buttonReply") + """The Message Sent when a customer clicks a button. Required.""" + list_reply: "_models.AcsMessageInteractiveListReplyContent" = rest_field(name="listReply") + """The Message Sent when a customer selects an item from a list. Required.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.AcsInteractiveReplyKind"], + button_reply: "_models.AcsMessageInteractiveButtonReplyContent", + list_reply: "_models.AcsMessageInteractiveListReplyContent", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageInteractiveListReplyContent(_model_base.Model): + """Message Interactive list reply content for a user to business message. + + :ivar id: The ID of the selected list item. + :vartype id: str + :ivar title: The title of the selected list item. + :vartype title: str + :ivar description: The description of the selected row. + :vartype description: str + """ + + id: Optional[str] = rest_field() + """The ID of the selected list item.""" + title: Optional[str] = rest_field() + """The title of the selected list item.""" + description: Optional[str] = rest_field() + """The description of the selected row.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + title: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageMediaContent(_model_base.Model): + """Message Media Content. + + :ivar mime_type: The MIME type of the file this media represents. + :vartype mime_type: str + :ivar id: The media identifier. + :vartype id: str + :ivar file_name: The filename of the underlying media file as specified when uploaded. + :vartype file_name: str + :ivar caption: The caption for the media object, if supported and provided. + :vartype caption: str + """ + + mime_type: Optional[str] = rest_field(name="mimeType") + """The MIME type of the file this media represents.""" + id: Optional[str] = rest_field() + """The media identifier.""" + file_name: Optional[str] = rest_field(name="fileName") + """The filename of the underlying media file as specified when uploaded.""" + caption: Optional[str] = rest_field() + """The caption for the media object, if supported and provided.""" + + @overload + def __init__( + self, + *, + mime_type: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + file_name: Optional[str] = None, + caption: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsMessageReceivedEventData(AcsMessageEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.AdvancedMessageReceived event. + + + :ivar from_property: The message sender. + :vartype from_property: str + :ivar to: The message recipient. + :vartype to: str + :ivar received_time_stamp: The time message was received. Required. + :vartype received_time_stamp: ~datetime.datetime + :ivar error: The channel event error. Required. + :vartype error: ~azure.eventgrid.models.AcsMessageChannelEventError + :ivar content: The message content. + :vartype content: str + :ivar channel_type: The message channel type. Required. "whatsapp" + :vartype channel_type: str or ~azure.eventgrid.models.AcsMessageChannelKind + :ivar media: The received message media content. Required. + :vartype media: ~azure.eventgrid.models.AcsMessageMediaContent + :ivar context: The received message context. Required. + :vartype context: ~azure.eventgrid.models.AcsMessageContext + :ivar button: The received message button content. Required. + :vartype button: ~azure.eventgrid.models.AcsMessageButtonContent + :ivar interactive: The received message interactive content. Required. + :vartype interactive: ~azure.eventgrid.models.AcsMessageInteractiveContent + """ + + content: Optional[str] = rest_field() + """The message content.""" + channel_type: Union[str, "_models.AcsMessageChannelKind"] = rest_field(name="channelType") + """The message channel type. Required. \"whatsapp\"""" + media: "_models.AcsMessageMediaContent" = rest_field() + """The received message media content. Required.""" + context: "_models.AcsMessageContext" = rest_field() + """The received message context. Required.""" + button: "_models.AcsMessageButtonContent" = rest_field() + """The received message button content. Required.""" + interactive: "_models.AcsMessageInteractiveContent" = rest_field() + """The received message interactive content. Required.""" + + @overload + def __init__( + self, + *, + received_time_stamp: datetime.datetime, + error: "_models.AcsMessageChannelEventError", + channel_type: Union[str, "_models.AcsMessageChannelKind"], + media: "_models.AcsMessageMediaContent", + context: "_models.AcsMessageContext", + button: "_models.AcsMessageButtonContent", + interactive: "_models.AcsMessageInteractiveContent", + from_property: Optional[str] = None, + to: Optional[str] = None, + content: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRecordingChunkInfoProperties(_model_base.Model): + """Schema for all properties of Recording Chunk Information. + + :ivar document_id: The documentId of the recording chunk. + :vartype document_id: str + :ivar index: The index of the recording chunk. + :vartype index: int + :ivar end_reason: The reason for ending the recording chunk. + :vartype end_reason: str + :ivar metadata_location: The location of the metadata for this chunk. + :vartype metadata_location: str + :ivar content_location: The location of the content for this chunk. + :vartype content_location: str + :ivar delete_location: The location to delete all chunk storage. + :vartype delete_location: str + """ + + document_id: Optional[str] = rest_field(name="documentId") + """The documentId of the recording chunk.""" + index: Optional[int] = rest_field() + """The index of the recording chunk.""" + end_reason: Optional[str] = rest_field(name="endReason") + """The reason for ending the recording chunk.""" + metadata_location: Optional[str] = rest_field(name="metadataLocation") + """The location of the metadata for this chunk.""" + content_location: Optional[str] = rest_field(name="contentLocation") + """The location of the content for this chunk.""" + delete_location: Optional[str] = rest_field(name="deleteLocation") + """The location to delete all chunk storage.""" + + @overload + def __init__( + self, + *, + document_id: Optional[str] = None, + index: Optional[int] = None, + end_reason: Optional[str] = None, + metadata_location: Optional[str] = None, + content_location: Optional[str] = None, + delete_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRecordingFileStatusUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RecordingFileStatusUpdated event. + + + :ivar recording_storage_info: The details of recording storage information. Required. + :vartype recording_storage_info: ~azure.eventgrid.models.AcsRecordingStorageInfoProperties + :ivar recording_start_time: The time at which the recording started. Required. + :vartype recording_start_time: ~datetime.datetime + :ivar recording_duration_ms: The recording duration in milliseconds. + :vartype recording_duration_ms: int + :ivar recording_content_type: The recording content type- AudioVideo, or Audio. Required. Known + values are: "AudioVideo" and "Audio". + :vartype recording_content_type: str or ~azure.eventgrid.models.RecordingContentType + :ivar recording_channel_type: The recording channel type - Mixed, Unmixed. Required. Known + values are: "Mixed" and "Unmixed". + :vartype recording_channel_type: str or ~azure.eventgrid.models.RecordingChannelType + :ivar recording_format_type: The recording format type - Mp4, Mp3, Wav. Required. Known values + are: "Wav", "Mp3", and "Mp4". + :vartype recording_format_type: str or ~azure.eventgrid.models.RecordingFormatType + :ivar session_end_reason: The reason for ending recording session. + :vartype session_end_reason: str + """ + + recording_storage_info: "_models.AcsRecordingStorageInfoProperties" = rest_field(name="recordingStorageInfo") + """The details of recording storage information. Required.""" + recording_start_time: datetime.datetime = rest_field(name="recordingStartTime", format="rfc3339") + """The time at which the recording started. Required.""" + recording_duration_ms: Optional[int] = rest_field(name="recordingDurationMs") + """The recording duration in milliseconds.""" + recording_content_type: Union[str, "_models.RecordingContentType"] = rest_field(name="recordingContentType") + """The recording content type- AudioVideo, or Audio. Required. Known values are: \"AudioVideo\" + and \"Audio\".""" + recording_channel_type: Union[str, "_models.RecordingChannelType"] = rest_field(name="recordingChannelType") + """The recording channel type - Mixed, Unmixed. Required. Known values are: \"Mixed\" and + \"Unmixed\".""" + recording_format_type: Union[str, "_models.RecordingFormatType"] = rest_field(name="recordingFormatType") + """The recording format type - Mp4, Mp3, Wav. Required. Known values are: \"Wav\", \"Mp3\", and + \"Mp4\".""" + session_end_reason: Optional[str] = rest_field(name="sessionEndReason") + """The reason for ending recording session.""" + + @overload + def __init__( + self, + *, + recording_storage_info: "_models.AcsRecordingStorageInfoProperties", + recording_start_time: datetime.datetime, + recording_content_type: Union[str, "_models.RecordingContentType"], + recording_channel_type: Union[str, "_models.RecordingChannelType"], + recording_format_type: Union[str, "_models.RecordingFormatType"], + recording_duration_ms: Optional[int] = None, + session_end_reason: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRecordingStorageInfoProperties(_model_base.Model): + """Schema for all properties of Recording Storage Information. + + + :ivar recording_chunks: List of details of recording chunks information. Required. + :vartype recording_chunks: list[~azure.eventgrid.models.AcsRecordingChunkInfoProperties] + """ + + recording_chunks: List["_models.AcsRecordingChunkInfoProperties"] = rest_field(name="recordingChunks") + """List of details of recording chunks information. Required.""" + + @overload + def __init__( + self, + *, + recording_chunks: List["_models.AcsRecordingChunkInfoProperties"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterChannelConfiguration(_model_base.Model): + """Router Channel Configuration. + + :ivar channel_id: Channel ID for Router Job. + :vartype channel_id: str + :ivar capacity_cost_per_job: Capacity Cost Per Job for Router Job. + :vartype capacity_cost_per_job: int + :ivar max_number_of_jobs: Max Number of Jobs for Router Job. + :vartype max_number_of_jobs: int + """ + + channel_id: Optional[str] = rest_field(name="channelId") + """Channel ID for Router Job.""" + capacity_cost_per_job: Optional[int] = rest_field(name="capacityCostPerJob") + """Capacity Cost Per Job for Router Job.""" + max_number_of_jobs: Optional[int] = rest_field(name="maxNumberOfJobs") + """Max Number of Jobs for Router Job.""" + + @overload + def __init__( + self, + *, + channel_id: Optional[str] = None, + capacity_cost_per_job: Optional[int] = None, + max_number_of_jobs: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterCommunicationError(_model_base.Model): + """Router Communication Error. + + + :ivar code: Router Communication Error Code. + :vartype code: str + :ivar message: Router Communication Error Message. + :vartype message: str + :ivar target: Router Communication Error Target. + :vartype target: str + :ivar innererror: Router Communication Inner Error. Required. + :vartype innererror: ~azure.eventgrid.models.AcsRouterCommunicationError + :ivar details: List of Router Communication Errors. Required. + :vartype details: list[~azure.eventgrid.models.AcsRouterCommunicationError] + """ + + code: Optional[str] = rest_field() + """Router Communication Error Code.""" + message: Optional[str] = rest_field() + """Router Communication Error Message.""" + target: Optional[str] = rest_field() + """Router Communication Error Target.""" + innererror: "_models.AcsRouterCommunicationError" = rest_field() + """Router Communication Inner Error. Required.""" + details: List["_models.AcsRouterCommunicationError"] = rest_field() + """List of Router Communication Errors. Required.""" + + @overload + def __init__( + self, + *, + innererror: "_models.AcsRouterCommunicationError", + details: List["_models.AcsRouterCommunicationError"], + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterEventData(_model_base.Model): + """Schema of common properties of all Router events. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + """ + + job_id: Optional[str] = rest_field(name="jobId") + """Router Event Job ID.""" + channel_reference: Optional[str] = rest_field(name="channelReference") + """Router Event Channel Reference.""" + channel_id: Optional[str] = rest_field(name="channelId") + """Router Event Channel ID.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobEventData(AcsRouterEventData): + """Schema of common properties of all Router Job events. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Job events Queue Id.""" + labels: Dict[str, str] = rest_field() + """Router Job events Labels. Required.""" + tags: Dict[str, str] = rest_field() + """Router Jobs events Tags. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobCancelledEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobCancelled event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar note: Router Job Note. + :vartype note: str + :ivar disposition_code: Router Job Disposition Code. + :vartype disposition_code: str + """ + + note: Optional[str] = rest_field() + """Router Job Note.""" + disposition_code: Optional[str] = rest_field(name="dispositionCode") + """Router Job Disposition Code.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + note: Optional[str] = None, + disposition_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobClassificationFailedEventData(AcsRouterJobEventData): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobClassificationFailed event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar classification_policy_id: Router Job Classification Policy Id. + :vartype classification_policy_id: str + :ivar errors: Router Job Classification Failed Errors. Required. + :vartype errors: list[~azure.eventgrid.models.AcsRouterCommunicationError] + """ + + classification_policy_id: Optional[str] = rest_field(name="classificationPolicyId") + """Router Job Classification Policy Id.""" + errors: List["_models.AcsRouterCommunicationError"] = rest_field() + """Router Job Classification Failed Errors. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + errors: List["_models.AcsRouterCommunicationError"], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + classification_policy_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobClassifiedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobClassified event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar queue_details: Router Job Queue Info. Required. + :vartype queue_details: ~azure.eventgrid.models.AcsRouterQueueDetails + :ivar classification_policy_id: Router Job Classification Policy Id. + :vartype classification_policy_id: str + :ivar priority: Router Job Priority. + :vartype priority: int + :ivar attached_worker_selectors: Router Job Attached Worker Selector. Required. + :vartype attached_worker_selectors: list[~azure.eventgrid.models.AcsRouterWorkerSelector] + """ + + queue_details: "_models.AcsRouterQueueDetails" = rest_field(name="queueDetails") + """Router Job Queue Info. Required.""" + classification_policy_id: Optional[str] = rest_field(name="classificationPolicyId") + """Router Job Classification Policy Id.""" + priority: Optional[int] = rest_field() + """Router Job Priority.""" + attached_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field(name="attachedWorkerSelectors") + """Router Job Attached Worker Selector. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + queue_details: "_models.AcsRouterQueueDetails", + attached_worker_selectors: List["_models.AcsRouterWorkerSelector"], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + classification_policy_id: Optional[str] = None, + priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobClosedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClosed + event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar assignment_id: Router Job Closed Assignment Id. + :vartype assignment_id: str + :ivar worker_id: Router Job Closed Worker Id. + :vartype worker_id: str + :ivar disposition_code: Router Job Closed Disposition Code. + :vartype disposition_code: str + """ + + assignment_id: Optional[str] = rest_field(name="assignmentId") + """Router Job Closed Assignment Id.""" + worker_id: Optional[str] = rest_field(name="workerId") + """Router Job Closed Worker Id.""" + disposition_code: Optional[str] = rest_field(name="dispositionCode") + """Router Job Closed Disposition Code.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + assignment_id: Optional[str] = None, + worker_id: Optional[str] = None, + disposition_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobCompletedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobCompleted event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar assignment_id: Router Job Completed Assignment Id. + :vartype assignment_id: str + :ivar worker_id: Router Job Completed Worker Id. + :vartype worker_id: str + """ + + assignment_id: Optional[str] = rest_field(name="assignmentId") + """Router Job Completed Assignment Id.""" + worker_id: Optional[str] = rest_field(name="workerId") + """Router Job Completed Worker Id.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + assignment_id: Optional[str] = None, + worker_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobDeletedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobDeleted + event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + """ + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobExceptionTriggeredEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobExceptionTriggered event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar rule_key: Router Job Exception Triggered Rule Key. + :vartype rule_key: str + :ivar exception_rule_id: Router Job Exception Triggered Rule Id. + :vartype exception_rule_id: str + """ + + rule_key: Optional[str] = rest_field(name="ruleKey") + """Router Job Exception Triggered Rule Key.""" + exception_rule_id: Optional[str] = rest_field(name="exceptionRuleId") + """Router Job Exception Triggered Rule Id.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + rule_key: Optional[str] = None, + exception_rule_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobQueuedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobQueued + event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar priority: Router Job Priority. + :vartype priority: int + :ivar attached_worker_selectors: Router Job Queued Attached Worker Selector. Required. + :vartype attached_worker_selectors: list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar requested_worker_selectors: Router Job Queued Requested Worker Selector. Required. + :vartype requested_worker_selectors: list[~azure.eventgrid.models.AcsRouterWorkerSelector] + """ + + priority: Optional[int] = rest_field() + """Router Job Priority.""" + attached_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field(name="attachedWorkerSelectors") + """Router Job Queued Attached Worker Selector. Required.""" + requested_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field(name="requestedWorkerSelectors") + """Router Job Queued Requested Worker Selector. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + attached_worker_selectors: List["_models.AcsRouterWorkerSelector"], + requested_worker_selectors: List["_models.AcsRouterWorkerSelector"], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobReceivedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobReceived event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar job_status: Router Job Received Job Status. Required. Known values are: + "PendingClassification", "Queued", "Assigned", "Completed", "Closed", "Cancelled", + "ClassificationFailed", "Created", "PendingSchedule", "Scheduled", "ScheduleFailed", and + "WaitingForActivation". + :vartype job_status: str or ~azure.eventgrid.models.AcsRouterJobStatus + :ivar classification_policy_id: Router Job Classification Policy Id. + :vartype classification_policy_id: str + :ivar priority: Router Job Priority. + :vartype priority: int + :ivar requested_worker_selectors: Router Job Received Requested Worker Selectors. Required. + :vartype requested_worker_selectors: list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar scheduled_on: Router Job Received Scheduled Time in UTC. Required. + :vartype scheduled_on: ~datetime.datetime + :ivar unavailable_for_matching: Unavailable For Matching for Router Job Received. Required. + :vartype unavailable_for_matching: bool + """ + + job_status: Union[str, "_models.AcsRouterJobStatus"] = rest_field(name="jobStatus") + """Router Job Received Job Status. Required. Known values are: \"PendingClassification\", + \"Queued\", \"Assigned\", \"Completed\", \"Closed\", \"Cancelled\", \"ClassificationFailed\", + \"Created\", \"PendingSchedule\", \"Scheduled\", \"ScheduleFailed\", and + \"WaitingForActivation\".""" + classification_policy_id: Optional[str] = rest_field(name="classificationPolicyId") + """Router Job Classification Policy Id.""" + priority: Optional[int] = rest_field() + """Router Job Priority.""" + requested_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field(name="requestedWorkerSelectors") + """Router Job Received Requested Worker Selectors. Required.""" + scheduled_on: datetime.datetime = rest_field(name="scheduledOn", format="rfc3339") + """Router Job Received Scheduled Time in UTC. Required.""" + unavailable_for_matching: bool = rest_field(name="unavailableForMatching") + """Unavailable For Matching for Router Job Received. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_status: Union[str, "_models.AcsRouterJobStatus"], + requested_worker_selectors: List["_models.AcsRouterWorkerSelector"], + scheduled_on: datetime.datetime, + unavailable_for_matching: bool, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + classification_policy_id: Optional[str] = None, + priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobSchedulingFailedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobSchedulingFailed event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar priority: Router Job Priority. + :vartype priority: int + :ivar expired_attached_worker_selectors: Router Job Scheduling Failed Attached Worker Selector + Expired. Required. + :vartype expired_attached_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar expired_requested_worker_selectors: Router Job Scheduling Failed Requested Worker + Selector Expired. Required. + :vartype expired_requested_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar scheduled_on: Router Job Scheduling Failed Scheduled Time in UTC. Required. + :vartype scheduled_on: ~datetime.datetime + :ivar failure_reason: Router Job Scheduling Failed Reason. + :vartype failure_reason: str + """ + + priority: Optional[int] = rest_field() + """Router Job Priority.""" + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredAttachedWorkerSelectors" + ) + """Router Job Scheduling Failed Attached Worker Selector Expired. Required.""" + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredRequestedWorkerSelectors" + ) + """Router Job Scheduling Failed Requested Worker Selector Expired. Required.""" + scheduled_on: datetime.datetime = rest_field(name="scheduledOn", format="rfc3339") + """Router Job Scheduling Failed Scheduled Time in UTC. Required.""" + failure_reason: Optional[str] = rest_field(name="failureReason") + """Router Job Scheduling Failed Reason.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"], + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"], + scheduled_on: datetime.datetime, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + priority: Optional[int] = None, + failure_reason: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobUnassignedEventData(AcsRouterJobEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobUnassigned event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar assignment_id: Router Job Unassigned Assignment Id. + :vartype assignment_id: str + :ivar worker_id: Router Job Unassigned Worker Id. + :vartype worker_id: str + """ + + assignment_id: Optional[str] = rest_field(name="assignmentId") + """Router Job Unassigned Assignment Id.""" + worker_id: Optional[str] = rest_field(name="workerId") + """Router Job Unassigned Worker Id.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + assignment_id: Optional[str] = None, + worker_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobWaitingForActivationEventData(AcsRouterJobEventData): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobWaitingForActivation event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar priority: Router Job Waiting For Activation Priority. + :vartype priority: int + :ivar expired_attached_worker_selectors: Router Job Waiting For Activation Worker Selector + Expired. Required. + :vartype expired_attached_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar expired_requested_worker_selectors: Router Job Waiting For Activation Requested Worker + Selector Expired. Required. + :vartype expired_requested_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar scheduled_on: Router Job Waiting For Activation Scheduled Time in UTC. Required. + :vartype scheduled_on: ~datetime.datetime + :ivar unavailable_for_matching: Router Job Waiting For Activation Unavailable For Matching. + Required. + :vartype unavailable_for_matching: bool + """ + + priority: Optional[int] = rest_field() + """Router Job Waiting For Activation Priority.""" + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredAttachedWorkerSelectors" + ) + """Router Job Waiting For Activation Worker Selector Expired. Required.""" + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredRequestedWorkerSelectors" + ) + """Router Job Waiting For Activation Requested Worker Selector Expired. Required.""" + scheduled_on: datetime.datetime = rest_field(name="scheduledOn", format="rfc3339") + """Router Job Waiting For Activation Scheduled Time in UTC. Required.""" + unavailable_for_matching: bool = rest_field(name="unavailableForMatching") + """Router Job Waiting For Activation Unavailable For Matching. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"], + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"], + scheduled_on: datetime.datetime, + unavailable_for_matching: bool, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterJobWorkerSelectorsExpiredEventData(AcsRouterJobEventData): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterJobWorkerSelectorsExpired event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar queue_id: Router Job events Queue Id. + :vartype queue_id: str + :ivar labels: Router Job events Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Jobs events Tags. Required. + :vartype tags: dict[str, str] + :ivar expired_requested_worker_selectors: Router Job Worker Selectors Expired Requested Worker + Selectors. Required. + :vartype expired_requested_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + :ivar expired_attached_worker_selectors: Router Job Worker Selectors Expired Attached Worker + Selectors. Required. + :vartype expired_attached_worker_selectors: + list[~azure.eventgrid.models.AcsRouterWorkerSelector] + """ + + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredRequestedWorkerSelectors" + ) + """Router Job Worker Selectors Expired Requested Worker Selectors. Required.""" + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"] = rest_field( + name="expiredAttachedWorkerSelectors" + ) + """Router Job Worker Selectors Expired Attached Worker Selectors. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + tags: Dict[str, str], + expired_requested_worker_selectors: List["_models.AcsRouterWorkerSelector"], + expired_attached_worker_selectors: List["_models.AcsRouterWorkerSelector"], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + queue_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterQueueDetails(_model_base.Model): + """Router Queue Details. + + + :ivar id: Router Queue Id. + :vartype id: str + :ivar name: Router Queue Name. + :vartype name: str + :ivar labels: Router Queue Labels. Required. + :vartype labels: dict[str, str] + """ + + id: Optional[str] = rest_field() + """Router Queue Id.""" + name: Optional[str] = rest_field() + """Router Queue Name.""" + labels: Dict[str, str] = rest_field() + """Router Queue Labels. Required.""" + + @overload + def __init__( + self, + *, + labels: Dict[str, str], + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerEventData(AcsRouterEventData): + """Schema of common properties of all Router Worker events. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + """ + + worker_id: Optional[str] = rest_field(name="workerId") + """Router Worker events Worker Id.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerDeletedEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerDeleted event. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + """ + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerDeregisteredEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerDeregistered event. + + :ivar worker_id: Router Worker Deregistered Worker Id. + :vartype worker_id: str + """ + + worker_id: Optional[str] = rest_field(name="workerId") + """Router Worker Deregistered Worker Id.""" + + @overload + def __init__( + self, + *, + worker_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerOfferAcceptedEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerOfferAccepted event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + :ivar queue_id: Router Worker Offer Accepted Queue Id. + :vartype queue_id: str + :ivar offer_id: Router Worker Offer Accepted Offer Id. + :vartype offer_id: str + :ivar assignment_id: Router Worker Offer Accepted Assignment Id. + :vartype assignment_id: str + :ivar job_priority: Router Worker Offer Accepted Job Priority. + :vartype job_priority: int + :ivar worker_labels: Router Worker Offer Accepted Worker Labels. Required. + :vartype worker_labels: dict[str, str] + :ivar worker_tags: Router Worker Offer Accepted Worker Tags. Required. + :vartype worker_tags: dict[str, str] + :ivar job_labels: Router Worker Offer Accepted Job Labels. Required. + :vartype job_labels: dict[str, str] + :ivar job_tags: Router Worker Offer Accepted Job Tags. Required. + :vartype job_tags: dict[str, str] + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Worker Offer Accepted Queue Id.""" + offer_id: Optional[str] = rest_field(name="offerId") + """Router Worker Offer Accepted Offer Id.""" + assignment_id: Optional[str] = rest_field(name="assignmentId") + """Router Worker Offer Accepted Assignment Id.""" + job_priority: Optional[int] = rest_field(name="jobPriority") + """Router Worker Offer Accepted Job Priority.""" + worker_labels: Dict[str, str] = rest_field(name="workerLabels") + """Router Worker Offer Accepted Worker Labels. Required.""" + worker_tags: Dict[str, str] = rest_field(name="workerTags") + """Router Worker Offer Accepted Worker Tags. Required.""" + job_labels: Dict[str, str] = rest_field(name="jobLabels") + """Router Worker Offer Accepted Job Labels. Required.""" + job_tags: Dict[str, str] = rest_field(name="jobTags") + """Router Worker Offer Accepted Job Tags. Required.""" + + @overload + def __init__( + self, + *, + worker_labels: Dict[str, str], + worker_tags: Dict[str, str], + job_labels: Dict[str, str], + job_tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + queue_id: Optional[str] = None, + offer_id: Optional[str] = None, + assignment_id: Optional[str] = None, + job_priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerOfferDeclinedEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerOfferDeclined event. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + :ivar queue_id: Router Worker Offer Declined Queue Id. + :vartype queue_id: str + :ivar offer_id: Router Worker Offer Declined Offer Id. + :vartype offer_id: str + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Worker Offer Declined Queue Id.""" + offer_id: Optional[str] = rest_field(name="offerId") + """Router Worker Offer Declined Offer Id.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + queue_id: Optional[str] = None, + offer_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerOfferExpiredEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerOfferExpired event. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + :ivar queue_id: Router Worker Offer Expired Queue Id. + :vartype queue_id: str + :ivar offer_id: Router Worker Offer Expired Offer Id. + :vartype offer_id: str + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Worker Offer Expired Queue Id.""" + offer_id: Optional[str] = rest_field(name="offerId") + """Router Worker Offer Expired Offer Id.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + queue_id: Optional[str] = None, + offer_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerOfferIssuedEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerOfferIssued event. + + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + :ivar queue_id: Router Worker Offer Issued Queue Id. + :vartype queue_id: str + :ivar offer_id: Router Worker Offer Issued Offer Id. + :vartype offer_id: str + :ivar job_priority: Router Worker Offer Issued Job Priority. + :vartype job_priority: int + :ivar worker_labels: Router Worker Offer Issued Worker Labels. Required. + :vartype worker_labels: dict[str, str] + :ivar offered_on: Router Worker Offer Issued Time in UTC. Required. + :vartype offered_on: ~datetime.datetime + :ivar expires_on: Router Worker Offer Issued Expiration Time in UTC. Required. + :vartype expires_on: ~datetime.datetime + :ivar worker_tags: Router Worker Offer Issued Worker Tags. Required. + :vartype worker_tags: dict[str, str] + :ivar job_labels: Router Worker Offer Issued Job Labels. Required. + :vartype job_labels: dict[str, str] + :ivar job_tags: Router Worker Offer Issued Job Tags. Required. + :vartype job_tags: dict[str, str] + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Worker Offer Issued Queue Id.""" + offer_id: Optional[str] = rest_field(name="offerId") + """Router Worker Offer Issued Offer Id.""" + job_priority: Optional[int] = rest_field(name="jobPriority") + """Router Worker Offer Issued Job Priority.""" + worker_labels: Dict[str, str] = rest_field(name="workerLabels") + """Router Worker Offer Issued Worker Labels. Required.""" + offered_on: datetime.datetime = rest_field(name="offeredOn", format="rfc3339") + """Router Worker Offer Issued Time in UTC. Required.""" + expires_on: datetime.datetime = rest_field(name="expiresOn", format="rfc3339") + """Router Worker Offer Issued Expiration Time in UTC. Required.""" + worker_tags: Dict[str, str] = rest_field(name="workerTags") + """Router Worker Offer Issued Worker Tags. Required.""" + job_labels: Dict[str, str] = rest_field(name="jobLabels") + """Router Worker Offer Issued Job Labels. Required.""" + job_tags: Dict[str, str] = rest_field(name="jobTags") + """Router Worker Offer Issued Job Tags. Required.""" + + @overload + def __init__( + self, + *, + worker_labels: Dict[str, str], + offered_on: datetime.datetime, + expires_on: datetime.datetime, + worker_tags: Dict[str, str], + job_labels: Dict[str, str], + job_tags: Dict[str, str], + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + queue_id: Optional[str] = None, + offer_id: Optional[str] = None, + job_priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerOfferRevokedEventData(AcsRouterWorkerEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerOfferRevoked event. + + :ivar job_id: Router Event Job ID. + :vartype job_id: str + :ivar channel_reference: Router Event Channel Reference. + :vartype channel_reference: str + :ivar channel_id: Router Event Channel ID. + :vartype channel_id: str + :ivar worker_id: Router Worker events Worker Id. + :vartype worker_id: str + :ivar queue_id: Router Worker Offer Revoked Queue Id. + :vartype queue_id: str + :ivar offer_id: Router Worker Offer Revoked Offer Id. + :vartype offer_id: str + """ + + queue_id: Optional[str] = rest_field(name="queueId") + """Router Worker Offer Revoked Queue Id.""" + offer_id: Optional[str] = rest_field(name="offerId") + """Router Worker Offer Revoked Offer Id.""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + channel_reference: Optional[str] = None, + channel_id: Optional[str] = None, + worker_id: Optional[str] = None, + queue_id: Optional[str] = None, + offer_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerRegisteredEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerRegistered event. + + + :ivar worker_id: Router Worker Registered Worker Id. + :vartype worker_id: str + :ivar queue_assignments: Router Worker Registered Queue Info. Required. + :vartype queue_assignments: list[~azure.eventgrid.models.AcsRouterQueueDetails] + :ivar channel_configurations: Router Worker Registered Channel Configuration. Required. + :vartype channel_configurations: list[~azure.eventgrid.models.AcsRouterChannelConfiguration] + :ivar total_capacity: Router Worker Register Total Capacity. + :vartype total_capacity: int + :ivar labels: Router Worker Registered Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Worker Registered Tags. Required. + :vartype tags: dict[str, str] + """ + + worker_id: Optional[str] = rest_field(name="workerId") + """Router Worker Registered Worker Id.""" + queue_assignments: List["_models.AcsRouterQueueDetails"] = rest_field(name="queueAssignments") + """Router Worker Registered Queue Info. Required.""" + channel_configurations: List["_models.AcsRouterChannelConfiguration"] = rest_field(name="channelConfigurations") + """Router Worker Registered Channel Configuration. Required.""" + total_capacity: Optional[int] = rest_field(name="totalCapacity") + """Router Worker Register Total Capacity.""" + labels: Dict[str, str] = rest_field() + """Router Worker Registered Labels. Required.""" + tags: Dict[str, str] = rest_field() + """Router Worker Registered Tags. Required.""" + + @overload + def __init__( + self, + *, + queue_assignments: List["_models.AcsRouterQueueDetails"], + channel_configurations: List["_models.AcsRouterChannelConfiguration"], + labels: Dict[str, str], + tags: Dict[str, str], + worker_id: Optional[str] = None, + total_capacity: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerSelector(_model_base.Model): + """Router Job Worker Selector. + + + :ivar key: Router Job Worker Selector Key. + :vartype key: str + :ivar label_operator: Router Job Worker Selector Label Operator. Required. Known values are: + "Equal", "NotEqual", "Greater", "Less", "GreaterThanOrEqual", and "LessThanOrEqual". + :vartype label_operator: str or ~azure.eventgrid.models.AcsRouterLabelOperator + :ivar value: Router Job Worker Selector Value. Required. + :vartype value: any + :ivar ttl_seconds: Router Job Worker Selector Time to Live in Seconds. Required. + :vartype ttl_seconds: float + :ivar state: Router Job Worker Selector State. Required. Known values are: "active" and + "expired". + :vartype state: str or ~azure.eventgrid.models.AcsRouterWorkerSelectorState + :ivar expiration_time: Router Job Worker Selector Expiration Time. Required. + :vartype expiration_time: ~datetime.datetime + """ + + key: Optional[str] = rest_field() + """Router Job Worker Selector Key.""" + label_operator: Union[str, "_models.AcsRouterLabelOperator"] = rest_field(name="labelOperator") + """Router Job Worker Selector Label Operator. Required. Known values are: \"Equal\", \"NotEqual\", + \"Greater\", \"Less\", \"GreaterThanOrEqual\", and \"LessThanOrEqual\".""" + value: Any = rest_field() + """Router Job Worker Selector Value. Required.""" + ttl_seconds: float = rest_field(name="ttlSeconds") + """Router Job Worker Selector Time to Live in Seconds. Required.""" + state: Union[str, "_models.AcsRouterWorkerSelectorState"] = rest_field() + """Router Job Worker Selector State. Required. Known values are: \"active\" and \"expired\".""" + expiration_time: datetime.datetime = rest_field(name="expirationTime", format="rfc3339") + """Router Job Worker Selector Expiration Time. Required.""" + + @overload + def __init__( + self, + *, + label_operator: Union[str, "_models.AcsRouterLabelOperator"], + value: Any, + ttl_seconds: float, + state: Union[str, "_models.AcsRouterWorkerSelectorState"], + expiration_time: datetime.datetime, + key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsRouterWorkerUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.RouterWorkerUpdated event. + + + :ivar worker_id: Router Worker Updated Worker Id. + :vartype worker_id: str + :ivar queue_assignments: Router Worker Updated Queue Info. Required. + :vartype queue_assignments: list[~azure.eventgrid.models.AcsRouterQueueDetails] + :ivar channel_configurations: Router Worker Updated Channel Configuration. Required. + :vartype channel_configurations: list[~azure.eventgrid.models.AcsRouterChannelConfiguration] + :ivar total_capacity: Router Worker Updated Total Capacity. + :vartype total_capacity: int + :ivar labels: Router Worker Updated Labels. Required. + :vartype labels: dict[str, str] + :ivar tags: Router Worker Updated Tags. Required. + :vartype tags: dict[str, str] + :ivar updated_worker_properties: Router Worker Properties Updated. Required. + :vartype updated_worker_properties: list[str or + ~azure.eventgrid.models.AcsRouterUpdatedWorkerProperty] + """ + + worker_id: Optional[str] = rest_field(name="workerId") + """Router Worker Updated Worker Id.""" + queue_assignments: List["_models.AcsRouterQueueDetails"] = rest_field(name="queueAssignments") + """Router Worker Updated Queue Info. Required.""" + channel_configurations: List["_models.AcsRouterChannelConfiguration"] = rest_field(name="channelConfigurations") + """Router Worker Updated Channel Configuration. Required.""" + total_capacity: Optional[int] = rest_field(name="totalCapacity") + """Router Worker Updated Total Capacity.""" + labels: Dict[str, str] = rest_field() + """Router Worker Updated Labels. Required.""" + tags: Dict[str, str] = rest_field() + """Router Worker Updated Tags. Required.""" + updated_worker_properties: List[Union[str, "_models.AcsRouterUpdatedWorkerProperty"]] = rest_field( + name="updatedWorkerProperties" + ) + """Router Worker Properties Updated. Required.""" + + @overload + def __init__( + self, + *, + queue_assignments: List["_models.AcsRouterQueueDetails"], + channel_configurations: List["_models.AcsRouterChannelConfiguration"], + labels: Dict[str, str], + tags: Dict[str, str], + updated_worker_properties: List[Union[str, "_models.AcsRouterUpdatedWorkerProperty"]], + worker_id: Optional[str] = None, + total_capacity: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsSmsDeliveryAttemptProperties(_model_base.Model): + """Schema for details of a delivery attempt. + + + :ivar timestamp: TimeStamp when delivery was attempted. Required. + :vartype timestamp: ~datetime.datetime + :ivar segments_succeeded: Number of segments that were successfully delivered. + :vartype segments_succeeded: int + :ivar segments_failed: Number of segments whose delivery failed. + :vartype segments_failed: int + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """TimeStamp when delivery was attempted. Required.""" + segments_succeeded: Optional[int] = rest_field(name="segmentsSucceeded") + """Number of segments that were successfully delivered.""" + segments_failed: Optional[int] = rest_field(name="segmentsFailed") + """Number of segments whose delivery failed.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + segments_succeeded: Optional[int] = None, + segments_failed: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsSmsEventBaseProperties(_model_base.Model): + """Schema of common properties of all SMS events. + + :ivar message_id: The identity of the SMS message. + :vartype message_id: str + :ivar from_property: The identity of SMS message sender. + :vartype from_property: str + :ivar to: The identity of SMS message receiver. + :vartype to: str + """ + + message_id: Optional[str] = rest_field(name="messageId") + """The identity of the SMS message.""" + from_property: Optional[str] = rest_field(name="from") + """The identity of SMS message sender.""" + to: Optional[str] = rest_field() + """The identity of SMS message receiver.""" + + @overload + def __init__( + self, + *, + message_id: Optional[str] = None, + from_property: Optional[str] = None, + to: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsSmsDeliveryReportReceivedEventData(AcsSmsEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Communication.SMSDeliveryReportReceived event. + + + :ivar message_id: The identity of the SMS message. + :vartype message_id: str + :ivar from_property: The identity of SMS message sender. + :vartype from_property: str + :ivar to: The identity of SMS message receiver. + :vartype to: str + :ivar delivery_status: Status of Delivery. + :vartype delivery_status: str + :ivar delivery_status_details: Details about Delivery Status. + :vartype delivery_status_details: str + :ivar delivery_attempts: List of details of delivery attempts made. Required. + :vartype delivery_attempts: list[~azure.eventgrid.models.AcsSmsDeliveryAttemptProperties] + :ivar received_timestamp: The time at which the SMS delivery report was received. Required. + :vartype received_timestamp: ~datetime.datetime + :ivar tag: Customer Content. + :vartype tag: str + """ + + delivery_status: Optional[str] = rest_field(name="deliveryStatus") + """Status of Delivery.""" + delivery_status_details: Optional[str] = rest_field(name="deliveryStatusDetails") + """Details about Delivery Status.""" + delivery_attempts: List["_models.AcsSmsDeliveryAttemptProperties"] = rest_field(name="deliveryAttempts") + """List of details of delivery attempts made. Required.""" + received_timestamp: datetime.datetime = rest_field(name="receivedTimestamp", format="rfc3339") + """The time at which the SMS delivery report was received. Required.""" + tag: Optional[str] = rest_field() + """Customer Content.""" + + @overload + def __init__( + self, + *, + delivery_attempts: List["_models.AcsSmsDeliveryAttemptProperties"], + received_timestamp: datetime.datetime, + message_id: Optional[str] = None, + from_property: Optional[str] = None, + to: Optional[str] = None, + delivery_status: Optional[str] = None, + delivery_status_details: Optional[str] = None, + tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsSmsReceivedEventData(AcsSmsEventBaseProperties): + """Schema of the Data property of an EventGridEvent for a Microsoft.Communication.SMSReceived + event. + + + :ivar message_id: The identity of the SMS message. + :vartype message_id: str + :ivar from_property: The identity of SMS message sender. + :vartype from_property: str + :ivar to: The identity of SMS message receiver. + :vartype to: str + :ivar message: The SMS content. + :vartype message: str + :ivar received_timestamp: The time at which the SMS was received. Required. + :vartype received_timestamp: ~datetime.datetime + """ + + message: Optional[str] = rest_field() + """The SMS content.""" + received_timestamp: datetime.datetime = rest_field(name="receivedTimestamp", format="rfc3339") + """The time at which the SMS was received. Required.""" + + @overload + def __init__( + self, + *, + received_timestamp: datetime.datetime, + message_id: Optional[str] = None, + from_property: Optional[str] = None, + to: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsUserDisconnectedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an + Microsoft.Communication.UserDisconnected event. + + + :ivar user_communication_identifier: The communication identifier of the user who was + disconnected. Required. + :vartype user_communication_identifier: ~azure.eventgrid.models.CommunicationIdentifierModel + """ + + user_communication_identifier: "_models.CommunicationIdentifierModel" = rest_field( + name="userCommunicationIdentifier" + ) + """The communication identifier of the user who was disconnected. Required.""" + + @overload + def __init__( + self, + *, + user_communication_identifier: "_models.CommunicationIdentifierModel", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiCenterApiDefinitionAddedEventData(_model_base.Model): + """Schema of the data property of an EventGridEvent for a Microsoft.ApiCenter.ApiDefinitionAdded + event. + + + :ivar title: API definition title. Required. + :vartype title: str + :ivar description: API definition description. + :vartype description: str + :ivar specification: API definition specification. + :vartype specification: ~azure.eventgrid.models.ApiCenterApiSpecification + """ + + title: str = rest_field() + """API definition title. Required.""" + description: Optional[str] = rest_field() + """API definition description.""" + specification: Optional["_models.ApiCenterApiSpecification"] = rest_field() + """API definition specification.""" + + @overload + def __init__( + self, + *, + title: str, + description: Optional[str] = None, + specification: Optional["_models.ApiCenterApiSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiCenterApiDefinitionUpdatedEventData(_model_base.Model): + """Schema of the data property of an EventGridEvent for a Microsoft.ApiCenter.ApiDefinitionUpdated + event. + + + :ivar title: API definition title. Required. + :vartype title: str + :ivar description: API definition description. + :vartype description: str + :ivar specification: API definition specification. + :vartype specification: ~azure.eventgrid.models.ApiCenterApiSpecification + """ + + title: str = rest_field() + """API definition title. Required.""" + description: Optional[str] = rest_field() + """API definition description.""" + specification: Optional["_models.ApiCenterApiSpecification"] = rest_field() + """API definition specification.""" + + @overload + def __init__( + self, + *, + title: str, + description: Optional[str] = None, + specification: Optional["_models.ApiCenterApiSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiCenterApiSpecification(_model_base.Model): + """API specification details. + + + :ivar name: Specification name. Required. + :vartype name: str + :ivar version: Specification version. + :vartype version: str + """ + + name: str = rest_field() + """Specification name. Required.""" + version: Optional[str] = rest_field() + """Specification version.""" + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APICreated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIDeleted + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiReleaseCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.APIReleaseCreated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiReleaseDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.APIReleaseDeleted event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiReleaseUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.APIReleaseUpdated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementApiUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.APIUpdated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayApiAddedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayAPIAdded + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//apis/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//apis/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayApiRemovedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayAPIRemoved event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//apis/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//apis/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayCertificateAuthorityCreatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayCertificateAuthorityCreated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayCertificateAuthorityDeletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayCertificateAuthorityUpdatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//certificateAuthorities/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayCreated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayDeleted + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayHostnameConfigurationCreatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayHostnameConfigurationCreated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayHostnameConfigurationDeletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayHostnameConfigurationUpdatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways//hostnameConfigurations/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementGatewayUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayUpdated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateways/``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementProductCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductCreated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementProductDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductDeleted + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementProductUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductUpdated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementSubscriptionCreatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.SubscriptionCreated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementSubscriptionDeletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.SubscriptionDeleted event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementSubscriptionUpdatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ApiManagement.SubscriptionUpdated event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementUserCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserCreated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementUserDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserDeleted + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApiManagementUserUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.UserUpdated + event. + + :ivar resource_uri: The fully qualified ID of the resource that the compliance state change is + for, including the resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long + :vartype resource_uri: str + """ + + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The fully qualified ID of the resource that the compliance state change is for, including the + resource name and resource type. Uses the format, + ``/subscriptions//resourceGroups//Microsoft.ApiManagement/service///``. # pylint: disable=line-too-long""" + + @overload + def __init__( + self, + *, + resource_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppConfigurationKeyValueDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.AppConfiguration.KeyValueDeleted event. + + :ivar key: The key used to identify the key-value that was deleted. + :vartype key: str + :ivar label: The label, if any, used to identify the key-value that was deleted. + :vartype label: str + :ivar etag: The etag representing the key-value that was deleted. + :vartype etag: str + :ivar sync_token: The sync token representing the server state after the event. + :vartype sync_token: str + """ + + key: Optional[str] = rest_field() + """The key used to identify the key-value that was deleted.""" + label: Optional[str] = rest_field() + """The label, if any, used to identify the key-value that was deleted.""" + etag: Optional[str] = rest_field() + """The etag representing the key-value that was deleted.""" + sync_token: Optional[str] = rest_field(name="syncToken") + """The sync token representing the server state after the event.""" + + @overload + def __init__( + self, + *, + key: Optional[str] = None, + label: Optional[str] = None, + etag: Optional[str] = None, + sync_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppConfigurationKeyValueModifiedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.AppConfiguration.KeyValueModified event. + + :ivar key: The key used to identify the key-value that was modified. + :vartype key: str + :ivar label: The label, if any, used to identify the key-value that was modified. + :vartype label: str + :ivar etag: The etag representing the new state of the key-value. + :vartype etag: str + :ivar sync_token: The sync token representing the server state after the event. + :vartype sync_token: str + """ + + key: Optional[str] = rest_field() + """The key used to identify the key-value that was modified.""" + label: Optional[str] = rest_field() + """The label, if any, used to identify the key-value that was modified.""" + etag: Optional[str] = rest_field() + """The etag representing the new state of the key-value.""" + sync_token: Optional[str] = rest_field(name="syncToken") + """The sync token representing the server state after the event.""" + + @overload + def __init__( + self, + *, + key: Optional[str] = None, + label: Optional[str] = None, + etag: Optional[str] = None, + sync_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppConfigurationSnapshotEventData(_model_base.Model): + """Schema of common properties of snapshot events. + + :ivar name: The name of the snapshot. + :vartype name: str + :ivar etag: The etag representing the new state of the snapshot. + :vartype etag: str + :ivar sync_token: The sync token representing the server state after the event. + :vartype sync_token: str + """ + + name: Optional[str] = rest_field() + """The name of the snapshot.""" + etag: Optional[str] = rest_field() + """The etag representing the new state of the snapshot.""" + sync_token: Optional[str] = rest_field(name="syncToken") + """The sync token representing the server state after the event.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + etag: Optional[str] = None, + sync_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppConfigurationSnapshotCreatedEventData(AppConfigurationSnapshotEventData): + """Schema of the Data property of an EventGridEvent for a + Microsoft.AppConfiguration.SnapshotCreated event. + + :ivar name: The name of the snapshot. + :vartype name: str + :ivar etag: The etag representing the new state of the snapshot. + :vartype etag: str + :ivar sync_token: The sync token representing the server state after the event. + :vartype sync_token: str + """ + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + etag: Optional[str] = None, + sync_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppConfigurationSnapshotModifiedEventData(AppConfigurationSnapshotEventData): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.AppConfiguration.SnapshotModified event. + + :ivar name: The name of the snapshot. + :vartype name: str + :ivar etag: The etag representing the new state of the snapshot. + :vartype etag: str + :ivar sync_token: The sync token representing the server state after the event. + :vartype sync_token: str + """ + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + etag: Optional[str] = None, + sync_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppEventTypeDetail(_model_base.Model): + """Detail of action on the app. + + + :ivar action: Type of action of the operation. Required. Known values are: "Restarted", + "Stopped", "ChangedAppSettings", "Started", "Completed", and "Failed". + :vartype action: str or ~azure.eventgrid.models.AppAction + """ + + action: Union[str, "_models.AppAction"] = rest_field() + """Type of action of the operation. Required. Known values are: \"Restarted\", \"Stopped\", + \"ChangedAppSettings\", \"Started\", \"Completed\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + action: Union[str, "_models.AppAction"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AppServicePlanEventTypeDetail(_model_base.Model): + """Detail of action on the app service plan. + + + :ivar stamp_kind: Kind of environment where app service plan is. Required. Known values are: + "Public", "AseV1", and "AseV2". + :vartype stamp_kind: str or ~azure.eventgrid.models.StampKind + :ivar action: Type of action on the app service plan. Required. "Updated" + :vartype action: str or ~azure.eventgrid.models.AppServicePlanAction + :ivar status: Asynchronous operation status of the operation on the app service plan. Required. + Known values are: "Started", "Completed", and "Failed". + :vartype status: str or ~azure.eventgrid.models.AsyncStatus + """ + + stamp_kind: Union[str, "_models.StampKind"] = rest_field(name="stampKind") + """Kind of environment where app service plan is. Required. Known values are: \"Public\", + \"AseV1\", and \"AseV2\".""" + action: Union[str, "_models.AppServicePlanAction"] = rest_field() + """Type of action on the app service plan. Required. \"Updated\"""" + status: Union[str, "_models.AsyncStatus"] = rest_field() + """Asynchronous operation status of the operation on the app service plan. Required. Known values + are: \"Started\", \"Completed\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + stamp_kind: Union[str, "_models.StampKind"], + action: Union[str, "_models.AppServicePlanAction"], + status: Union[str, "_models.AsyncStatus"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for Microsoft.AVS/clusters events. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + """ + + operation_id: str = rest_field(name="operationId") + """Id of the operation that caused this event. Required.""" + added_host_names: Optional[List[str]] = rest_field(name="addedHostNames") + """Hosts added to the cluster in this event, if any.""" + removed_host_names: Optional[List[str]] = rest_field(name="removedHostNames") + """Hosts removed from the cluster in this event, if any.""" + in_maintenance_host_names: Optional[List[str]] = rest_field(name="inMaintenanceHostNames") + """Hosts in Maintenance mode in the cluster, if any.""" + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterCreatedEventData(AvsClusterEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterCreated event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterDeletedEventData(AvsClusterEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterDeleted event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterFailedEventData(AvsClusterEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterFailed event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + :ivar failure_message: Failure reason of an event. + :vartype failure_message: str + """ + + failure_message: Optional[str] = rest_field(name="failureMessage") + """Failure reason of an event.""" + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + failure_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterUpdatedEventData(AvsClusterEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterUpdated event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsClusterUpdatingEventData(AvsClusterEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterUpdating event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar added_host_names: Hosts added to the cluster in this event, if any. + :vartype added_host_names: list[str] + :ivar removed_host_names: Hosts removed from the cluster in this event, if any. + :vartype removed_host_names: list[str] + :ivar in_maintenance_host_names: Hosts in Maintenance mode in the cluster, if any. + :vartype in_maintenance_host_names: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + added_host_names: Optional[List[str]] = None, + removed_host_names: Optional[List[str]] = None, + in_maintenance_host_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsPrivateCloudEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for Microsoft.AVS/privateClouds events. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + """ + + operation_id: str = rest_field(name="operationId") + """Id of the operation that caused this event. Required.""" + + @overload + def __init__( + self, + *, + operation_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsPrivateCloudFailedEventData(AvsPrivateCloudEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudFailed event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar failure_message: Failure reason of an event. + :vartype failure_message: str + """ + + failure_message: Optional[str] = rest_field(name="failureMessage") + """Failure reason of an event.""" + + @overload + def __init__( + self, + *, + operation_id: str, + failure_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsPrivateCloudUpdatedEventData(AvsPrivateCloudEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudUpdated event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + """ + + @overload + def __init__( + self, + *, + operation_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsPrivateCloudUpdatingEventData(AvsPrivateCloudEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudUpdating + event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + """ + + @overload + def __init__( + self, + *, + operation_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsScriptExecutionEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for Microsoft.AVS/scriptExecutions events. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar cmdlet_id: Cmdlet referenced in the execution that caused this event. Required. + :vartype cmdlet_id: str + :ivar output: Stdout outputs from the execution, if any. + :vartype output: list[str] + """ + + operation_id: str = rest_field(name="operationId") + """Id of the operation that caused this event. Required.""" + cmdlet_id: str = rest_field(name="cmdletId") + """Cmdlet referenced in the execution that caused this event. Required.""" + output: Optional[List[str]] = rest_field() + """Stdout outputs from the execution, if any.""" + + @overload + def __init__( + self, + *, + operation_id: str, + cmdlet_id: str, + output: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsScriptExecutionCancelledEventData(AvsScriptExecutionEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionCancelled + event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar cmdlet_id: Cmdlet referenced in the execution that caused this event. Required. + :vartype cmdlet_id: str + :ivar output: Stdout outputs from the execution, if any. + :vartype output: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + cmdlet_id: str, + output: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsScriptExecutionFailedEventData(AvsScriptExecutionEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionFailed + event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar cmdlet_id: Cmdlet referenced in the execution that caused this event. Required. + :vartype cmdlet_id: str + :ivar output: Stdout outputs from the execution, if any. + :vartype output: list[str] + :ivar failure_message: Failure reason of an event. + :vartype failure_message: str + """ + + failure_message: Optional[str] = rest_field(name="failureMessage") + """Failure reason of an event.""" + + @overload + def __init__( + self, + *, + operation_id: str, + cmdlet_id: str, + output: Optional[List[str]] = None, + failure_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsScriptExecutionFinishedEventData(AvsScriptExecutionEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionFinished + event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar cmdlet_id: Cmdlet referenced in the execution that caused this event. Required. + :vartype cmdlet_id: str + :ivar output: Stdout outputs from the execution, if any. + :vartype output: list[str] + :ivar named_outputs: Named outputs of completed execution, if any. Required. + :vartype named_outputs: dict[str, str] + """ + + named_outputs: Dict[str, str] = rest_field(name="namedOutputs") + """Named outputs of completed execution, if any. Required.""" + + @overload + def __init__( + self, + *, + operation_id: str, + cmdlet_id: str, + named_outputs: Dict[str, str], + output: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AvsScriptExecutionStartedEventData(AvsScriptExecutionEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ScriptExecutionStarted + event. + + + :ivar operation_id: Id of the operation that caused this event. Required. + :vartype operation_id: str + :ivar cmdlet_id: Cmdlet referenced in the execution that caused this event. Required. + :vartype cmdlet_id: str + :ivar output: Stdout outputs from the execution, if any. + :vartype output: list[str] + """ + + @overload + def __init__( + self, + *, + operation_id: str, + cmdlet_id: str, + output: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunicationIdentifierModel(_model_base.Model): + """Identifies a participant in Azure Communication services. A participant is, for example, a + phone number or an Azure communication user. This model must be interpreted as a union: Apart + from rawId, at most one further property may be set. + + + :ivar kind: The identifier kind. Only required in responses. Required. Known values are: + "unknown", "communicationUser", "phoneNumber", and "microsoftTeamsUser". + :vartype kind: str or ~azure.eventgrid.models.CommunicationIdentifierModelKind + :ivar raw_id: Raw Id of the identifier. Optional in requests, required in responses. + :vartype raw_id: str + :ivar communication_user: The communication user. Required. + :vartype communication_user: ~azure.eventgrid.models.CommunicationUserIdentifierModel + :ivar phone_number: The phone number. Required. + :vartype phone_number: ~azure.eventgrid.models.PhoneNumberIdentifierModel + :ivar microsoft_teams_user: The Microsoft Teams user. Required. + :vartype microsoft_teams_user: ~azure.eventgrid.models.MicrosoftTeamsUserIdentifierModel + :ivar microsoft_teams_app: The Microsoft Teams application. Required. + :vartype microsoft_teams_app: ~azure.eventgrid.models.MicrosoftTeamsAppIdentifierModel + """ + + kind: Union[str, "_models.CommunicationIdentifierModelKind"] = rest_field() + """The identifier kind. Only required in responses. Required. Known values are: \"unknown\", + \"communicationUser\", \"phoneNumber\", and \"microsoftTeamsUser\".""" + raw_id: Optional[str] = rest_field(name="rawId") + """Raw Id of the identifier. Optional in requests, required in responses.""" + communication_user: "_models.CommunicationUserIdentifierModel" = rest_field(name="communicationUser") + """The communication user. Required.""" + phone_number: "_models.PhoneNumberIdentifierModel" = rest_field(name="phoneNumber") + """The phone number. Required.""" + microsoft_teams_user: "_models.MicrosoftTeamsUserIdentifierModel" = rest_field(name="microsoftTeamsUser") + """The Microsoft Teams user. Required.""" + microsoft_teams_app: "_models.MicrosoftTeamsAppIdentifierModel" = rest_field(name="microsoftTeamsApp") + """The Microsoft Teams application. Required.""" + + @overload + def __init__( + self, + *, + kind: Union[str, "_models.CommunicationIdentifierModelKind"], + communication_user: "_models.CommunicationUserIdentifierModel", + phone_number: "_models.PhoneNumberIdentifierModel", + microsoft_teams_user: "_models.MicrosoftTeamsUserIdentifierModel", + microsoft_teams_app: "_models.MicrosoftTeamsAppIdentifierModel", + raw_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunicationUserIdentifierModel(_model_base.Model): + """A user that got created with an Azure Communication Services resource. + + + :ivar id: The Id of the communication user. Required. + :vartype id: str + """ + + id: str = rest_field() + """The Id of the communication user. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryArtifactEventData(_model_base.Model): + """The content of the event request message. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryArtifactEventTarget + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + id: Optional[str] = rest_field() + """The event ID.""" + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + action: Optional[str] = rest_field() + """The action that encompasses the provided event.""" + location: Optional[str] = rest_field() + """The location of the event.""" + target: "_models.ContainerRegistryArtifactEventTarget" = rest_field() + """The target of the event. Required.""" + connected_registry: "_models.ContainerRegistryEventConnectedRegistry" = rest_field(name="connectedRegistry") + """The connected registry information if the event is generated by a connected registry. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryArtifactEventTarget", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryArtifactEventTarget(_model_base.Model): + """The target of the event. + + :ivar media_type: The MIME type of the artifact. + :vartype media_type: str + :ivar size: The size in bytes of the artifact. + :vartype size: int + :ivar digest: The digest of the artifact. + :vartype digest: str + :ivar repository: The repository name of the artifact. + :vartype repository: str + :ivar tag: The tag of the artifact. + :vartype tag: str + :ivar name: The name of the artifact. + :vartype name: str + :ivar version: The version of the artifact. + :vartype version: str + """ + + media_type: Optional[str] = rest_field(name="mediaType") + """The MIME type of the artifact.""" + size: Optional[int] = rest_field() + """The size in bytes of the artifact.""" + digest: Optional[str] = rest_field() + """The digest of the artifact.""" + repository: Optional[str] = rest_field() + """The repository name of the artifact.""" + tag: Optional[str] = rest_field() + """The tag of the artifact.""" + name: Optional[str] = rest_field() + """The name of the artifact.""" + version: Optional[str] = rest_field() + """The version of the artifact.""" + + @overload + def __init__( + self, + *, + media_type: Optional[str] = None, + size: Optional[int] = None, + digest: Optional[str] = None, + repository: Optional[str] = None, + tag: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryChartDeletedEventData(ContainerRegistryArtifactEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartDeleted + event. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryArtifactEventTarget + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryArtifactEventTarget", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryChartPushedEventData(ContainerRegistryArtifactEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ChartPushed + event. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryArtifactEventTarget + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryArtifactEventTarget", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventActor(_model_base.Model): + """The agent that initiated the event. For most situations, this could be from the authorization + context of the request. + + :ivar name: The subject or username associated with the request context that generated the + event. + :vartype name: str + """ + + name: Optional[str] = rest_field() + """The subject or username associated with the request context that generated the event.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventConnectedRegistry(_model_base.Model): + """The connected registry information if the event is generated by a connected registry. + + :ivar name: The name of the connected registry that generated this event. + :vartype name: str + """ + + name: Optional[str] = rest_field() + """The name of the connected registry that generated this event.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventData(_model_base.Model): + """The content of the event request message. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryEventTarget + :ivar request: The request that generated the event. Required. + :vartype request: ~azure.eventgrid.models.ContainerRegistryEventRequest + :ivar actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. Required. + :vartype actor: ~azure.eventgrid.models.ContainerRegistryEventActor + :ivar source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. Required. + :vartype source: ~azure.eventgrid.models.ContainerRegistryEventSource + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + id: Optional[str] = rest_field() + """The event ID.""" + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + action: Optional[str] = rest_field() + """The action that encompasses the provided event.""" + location: Optional[str] = rest_field() + """The location of the event.""" + target: "_models.ContainerRegistryEventTarget" = rest_field() + """The target of the event. Required.""" + request: "_models.ContainerRegistryEventRequest" = rest_field() + """The request that generated the event. Required.""" + actor: "_models.ContainerRegistryEventActor" = rest_field() + """The agent that initiated the event. For most situations, this could be from the authorization + context of the request. Required.""" + source: "_models.ContainerRegistryEventSource" = rest_field() + """The registry node that generated the event. Put differently, while the actor initiates the + event, the source generates it. Required.""" + connected_registry: "_models.ContainerRegistryEventConnectedRegistry" = rest_field(name="connectedRegistry") + """The connected registry information if the event is generated by a connected registry. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryEventTarget", + request: "_models.ContainerRegistryEventRequest", + actor: "_models.ContainerRegistryEventActor", + source: "_models.ContainerRegistryEventSource", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventRequest(_model_base.Model): + """The request that generated the event. + + :ivar id: The ID of the request that initiated the event. + :vartype id: str + :ivar addr: The IP or hostname and possibly port of the client connection that initiated the + event. This is the RemoteAddr from the standard http request. + :vartype addr: str + :ivar host: The externally accessible hostname of the registry instance, as specified by the + http host header on incoming requests. + :vartype host: str + :ivar method: The request method that generated the event. + :vartype method: str + :ivar useragent: The user agent header of the request. + :vartype useragent: str + """ + + id: Optional[str] = rest_field() + """The ID of the request that initiated the event.""" + addr: Optional[str] = rest_field() + """The IP or hostname and possibly port of the client connection that initiated the event. This is + the RemoteAddr from the standard http request.""" + host: Optional[str] = rest_field() + """The externally accessible hostname of the registry instance, as specified by the http host + header on incoming requests.""" + method: Optional[str] = rest_field() + """The request method that generated the event.""" + useragent: Optional[str] = rest_field() + """The user agent header of the request.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + addr: Optional[str] = None, + host: Optional[str] = None, + method: Optional[str] = None, + useragent: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventSource(_model_base.Model): + """The registry node that generated the event. Put differently, while the actor initiates the + event, the source generates it. + + :ivar addr: The IP or hostname and the port of the registry node that generated the event. + Generally, this will be resolved by os.Hostname() along with the running port. + :vartype addr: str + :ivar instance_id: The running instance of an application. Changes after each restart. + :vartype instance_id: str + """ + + addr: Optional[str] = rest_field() + """The IP or hostname and the port of the registry node that generated the event. Generally, this + will be resolved by os.Hostname() along with the running port.""" + instance_id: Optional[str] = rest_field(name="instanceID") + """The running instance of an application. Changes after each restart.""" + + @overload + def __init__( + self, + *, + addr: Optional[str] = None, + instance_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryEventTarget(_model_base.Model): + """The target of the event. + + :ivar media_type: The MIME type of the referenced object. + :vartype media_type: str + :ivar size: The number of bytes of the content. Same as Length field. + :vartype size: int + :ivar digest: The digest of the content, as defined by the Registry V2 HTTP API Specification. + :vartype digest: str + :ivar length: The number of bytes of the content. Same as Size field. + :vartype length: int + :ivar repository: The repository name. + :vartype repository: str + :ivar url: The direct URL to the content. + :vartype url: str + :ivar tag: The tag name. + :vartype tag: str + """ + + media_type: Optional[str] = rest_field(name="mediaType") + """The MIME type of the referenced object.""" + size: Optional[int] = rest_field() + """The number of bytes of the content. Same as Length field.""" + digest: Optional[str] = rest_field() + """The digest of the content, as defined by the Registry V2 HTTP API Specification.""" + length: Optional[int] = rest_field() + """The number of bytes of the content. Same as Size field.""" + repository: Optional[str] = rest_field() + """The repository name.""" + url: Optional[str] = rest_field() + """The direct URL to the content.""" + tag: Optional[str] = rest_field() + """The tag name.""" + + @overload + def __init__( + self, + *, + media_type: Optional[str] = None, + size: Optional[int] = None, + digest: Optional[str] = None, + length: Optional[int] = None, + repository: Optional[str] = None, + url: Optional[str] = None, + tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryImageDeletedEventData(ContainerRegistryEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImageDeleted + event. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryEventTarget + :ivar request: The request that generated the event. Required. + :vartype request: ~azure.eventgrid.models.ContainerRegistryEventRequest + :ivar actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. Required. + :vartype actor: ~azure.eventgrid.models.ContainerRegistryEventActor + :ivar source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. Required. + :vartype source: ~azure.eventgrid.models.ContainerRegistryEventSource + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryEventTarget", + request: "_models.ContainerRegistryEventRequest", + actor: "_models.ContainerRegistryEventActor", + source: "_models.ContainerRegistryEventSource", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerRegistryImagePushedEventData(ContainerRegistryEventData): + """Schema of the Data property of an EventGridEvent for a Microsoft.ContainerRegistry.ImagePushed + event. + + + :ivar id: The event ID. + :vartype id: str + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar action: The action that encompasses the provided event. + :vartype action: str + :ivar location: The location of the event. + :vartype location: str + :ivar target: The target of the event. Required. + :vartype target: ~azure.eventgrid.models.ContainerRegistryEventTarget + :ivar request: The request that generated the event. Required. + :vartype request: ~azure.eventgrid.models.ContainerRegistryEventRequest + :ivar actor: The agent that initiated the event. For most situations, this could be from the + authorization context of the request. Required. + :vartype actor: ~azure.eventgrid.models.ContainerRegistryEventActor + :ivar source: The registry node that generated the event. Put differently, while the actor + initiates the event, the source generates it. Required. + :vartype source: ~azure.eventgrid.models.ContainerRegistryEventSource + :ivar connected_registry: The connected registry information if the event is generated by a + connected registry. Required. + :vartype connected_registry: ~azure.eventgrid.models.ContainerRegistryEventConnectedRegistry + """ + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + target: "_models.ContainerRegistryEventTarget", + request: "_models.ContainerRegistryEventRequest", + actor: "_models.ContainerRegistryEventActor", + source: "_models.ContainerRegistryEventSource", + connected_registry: "_models.ContainerRegistryEventConnectedRegistry", + id: Optional[str] = None, # pylint: disable=redefined-builtin + action: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceClusterSupportEventData(_model_base.Model): + """Schema of common properties of cluster support events. + + :ivar kubernetes_version: The Kubernetes version of the ManagedCluster resource. + :vartype kubernetes_version: str + """ + + kubernetes_version: Optional[str] = rest_field(name="kubernetesVersion") + """The Kubernetes version of the ManagedCluster resource.""" + + @overload + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceClusterSupportEndedEventData( + ContainerServiceClusterSupportEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.ClusterSupportEnded event. + + :ivar kubernetes_version: The Kubernetes version of the ManagedCluster resource. + :vartype kubernetes_version: str + """ + + @overload + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceClusterSupportEndingEventData( + ContainerServiceClusterSupportEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.ClusterSupportEnding event. + + :ivar kubernetes_version: The Kubernetes version of the ManagedCluster resource. + :vartype kubernetes_version: str + """ + + @overload + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceNewKubernetesVersionAvailableEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.NewKubernetesVersionAvailable event. + + :ivar latest_supported_kubernetes_version: The highest PATCH Kubernetes version for the highest + MINOR version supported by ManagedCluster resource. + :vartype latest_supported_kubernetes_version: str + :ivar latest_stable_kubernetes_version: The highest PATCH Kubernetes version for the MINOR + version considered stable for the ManagedCluster resource. + :vartype latest_stable_kubernetes_version: str + :ivar lowest_minor_kubernetes_version: The highest PATCH Kubernetes version for the lowest + applicable MINOR version available for the ManagedCluster resource. + :vartype lowest_minor_kubernetes_version: str + :ivar latest_preview_kubernetes_version: The highest PATCH Kubernetes version considered + preview for the ManagedCluster resource. There might not be any version in preview at the time + of publishing the event. + :vartype latest_preview_kubernetes_version: str + """ + + latest_supported_kubernetes_version: Optional[str] = rest_field(name="latestSupportedKubernetesVersion") + """The highest PATCH Kubernetes version for the highest MINOR version supported by ManagedCluster + resource.""" + latest_stable_kubernetes_version: Optional[str] = rest_field(name="latestStableKubernetesVersion") + """The highest PATCH Kubernetes version for the MINOR version considered stable for the + ManagedCluster resource.""" + lowest_minor_kubernetes_version: Optional[str] = rest_field(name="lowestMinorKubernetesVersion") + """The highest PATCH Kubernetes version for the lowest applicable MINOR version available for the + ManagedCluster resource.""" + latest_preview_kubernetes_version: Optional[str] = rest_field(name="latestPreviewKubernetesVersion") + """The highest PATCH Kubernetes version considered preview for the ManagedCluster resource. There + might not be any version in preview at the time of publishing the event.""" + + @overload + def __init__( + self, + *, + latest_supported_kubernetes_version: Optional[str] = None, + latest_stable_kubernetes_version: Optional[str] = None, + lowest_minor_kubernetes_version: Optional[str] = None, + latest_preview_kubernetes_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceNodePoolRollingEventData(_model_base.Model): + """Schema of common properties of node pool rolling events. + + :ivar node_pool_name: The name of the node pool in the ManagedCluster resource. + :vartype node_pool_name: str + """ + + node_pool_name: Optional[str] = rest_field(name="nodePoolName") + """The name of the node pool in the ManagedCluster resource.""" + + @overload + def __init__( + self, + *, + node_pool_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceNodePoolRollingFailedEventData( + ContainerServiceNodePoolRollingEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.NodePoolRollingFailed event. + + :ivar node_pool_name: The name of the node pool in the ManagedCluster resource. + :vartype node_pool_name: str + """ + + @overload + def __init__( + self, + *, + node_pool_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceNodePoolRollingStartedEventData( + ContainerServiceNodePoolRollingEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.NodePoolRollingStarted event. + + :ivar node_pool_name: The name of the node pool in the ManagedCluster resource. + :vartype node_pool_name: str + """ + + @overload + def __init__( + self, + *, + node_pool_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerServiceNodePoolRollingSucceededEventData( + ContainerServiceNodePoolRollingEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ContainerService.NodePoolRollingSucceeded event. + + :ivar node_pool_name: The name of the node pool in the ManagedCluster resource. + :vartype node_pool_name: str + """ + + @overload + def __init__( + self, + *, + node_pool_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataBoxCopyCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.CopyCompleted event. + + + :ivar serial_number: Serial Number of the device associated with the event. The list is comma + separated if more than one serial number is associated. + :vartype serial_number: str + :ivar stage_name: Name of the current Stage. Required. Known values are: "CopyStarted", + "CopyCompleted", and "OrderCompleted". + :vartype stage_name: str or ~azure.eventgrid.models.DataBoxStageName + :ivar stage_time: The time at which the stage happened. Required. + :vartype stage_time: ~datetime.datetime + """ + + serial_number: Optional[str] = rest_field(name="serialNumber") + """Serial Number of the device associated with the event. The list is comma separated if more than + one serial number is associated.""" + stage_name: Union[str, "_models.DataBoxStageName"] = rest_field(name="stageName") + """Name of the current Stage. Required. Known values are: \"CopyStarted\", \"CopyCompleted\", and + \"OrderCompleted\".""" + stage_time: datetime.datetime = rest_field(name="stageTime", format="rfc3339") + """The time at which the stage happened. Required.""" + + @overload + def __init__( + self, + *, + stage_name: Union[str, "_models.DataBoxStageName"], + stage_time: datetime.datetime, + serial_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataBoxCopyStartedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.CopyStarted event. + + + :ivar serial_number: Serial Number of the device associated with the event. The list is comma + separated if more than one serial number is associated. + :vartype serial_number: str + :ivar stage_name: Name of the current Stage. Required. Known values are: "CopyStarted", + "CopyCompleted", and "OrderCompleted". + :vartype stage_name: str or ~azure.eventgrid.models.DataBoxStageName + :ivar stage_time: The time at which the stage happened. Required. + :vartype stage_time: ~datetime.datetime + """ + + serial_number: Optional[str] = rest_field(name="serialNumber") + """Serial Number of the device associated with the event. The list is comma separated if more than + one serial number is associated.""" + stage_name: Union[str, "_models.DataBoxStageName"] = rest_field(name="stageName") + """Name of the current Stage. Required. Known values are: \"CopyStarted\", \"CopyCompleted\", and + \"OrderCompleted\".""" + stage_time: datetime.datetime = rest_field(name="stageTime", format="rfc3339") + """The time at which the stage happened. Required.""" + + @overload + def __init__( + self, + *, + stage_name: Union[str, "_models.DataBoxStageName"], + stage_time: datetime.datetime, + serial_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataBoxOrderCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.DataBox.OrderCompleted event. + + + :ivar serial_number: Serial Number of the device associated with the event. The list is comma + separated if more than one serial number is associated. + :vartype serial_number: str + :ivar stage_name: Name of the current Stage. Required. Known values are: "CopyStarted", + "CopyCompleted", and "OrderCompleted". + :vartype stage_name: str or ~azure.eventgrid.models.DataBoxStageName + :ivar stage_time: The time at which the stage happened. Required. + :vartype stage_time: ~datetime.datetime + """ + + serial_number: Optional[str] = rest_field(name="serialNumber") + """Serial Number of the device associated with the event. The list is comma separated if more than + one serial number is associated.""" + stage_name: Union[str, "_models.DataBoxStageName"] = rest_field(name="stageName") + """Name of the current Stage. Required. Known values are: \"CopyStarted\", \"CopyCompleted\", and + \"OrderCompleted\".""" + stage_time: datetime.datetime = rest_field(name="stageTime", format="rfc3339") + """The time at which the stage happened. Required.""" + + @overload + def __init__( + self, + *, + stage_name: Union[str, "_models.DataBoxStageName"], + stage_time: datetime.datetime, + serial_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceConnectionStateEventInfo(_model_base.Model): + """Information about the device connection state event. + + :ivar sequence_number: Sequence number is string representation of a hexadecimal number. string + compare can be used to identify the larger number because both in ASCII and HEX numbers come + after alphabets. If you are converting the string to hex, then the number is a 256 bit number. + :vartype sequence_number: str + """ + + sequence_number: Optional[str] = rest_field(name="sequenceNumber") + """Sequence number is string representation of a hexadecimal number. string compare can be used to + identify the larger number because both in ASCII and HEX numbers come after alphabets. If you + are converting the string to hex, then the number is a 256 bit number.""" + + @overload + def __init__( + self, + *, + sequence_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceConnectionStateEventProperties(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a device connection state event + (DeviceConnected, DeviceDisconnected). + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar module_id: The unique identifier of the module. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype module_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar device_connection_state_event_info: Information about the device connection state event. + Required. + :vartype device_connection_state_event_info: + ~azure.eventgrid.models.DeviceConnectionStateEventInfo + """ + + device_id: Optional[str] = rest_field(name="deviceId") + """The unique identifier of the device. This case-sensitive string can be up to 128 characters + long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - + : . + % _ # * ? ! ( ) , = ``@`` ; $ '.""" + module_id: Optional[str] = rest_field(name="moduleId") + """The unique identifier of the module. This case-sensitive string can be up to 128 characters + long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - + : . + % _ # * ? ! ( ) , = ``@`` ; $ '.""" + hub_name: Optional[str] = rest_field(name="hubName") + """Name of the IoT Hub where the device was created or deleted.""" + device_connection_state_event_info: "_models.DeviceConnectionStateEventInfo" = rest_field( + name="deviceConnectionStateEventInfo" + ) + """Information about the device connection state event. Required.""" + + @overload + def __init__( + self, + *, + device_connection_state_event_info: "_models.DeviceConnectionStateEventInfo", + device_id: Optional[str] = None, + module_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceLifeCycleEventProperties(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, + DeviceDeleted). + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar twin: Information about the device twin, which is the cloud representation of application + device metadata. Required. + :vartype twin: ~azure.eventgrid.models.DeviceTwinInfo + """ + + device_id: Optional[str] = rest_field(name="deviceId") + """The unique identifier of the device. This case-sensitive string can be up to 128 characters + long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - + : . + % _ # * ? ! ( ) , = ``@`` ; $ '.""" + hub_name: Optional[str] = rest_field(name="hubName") + """Name of the IoT Hub where the device was created or deleted.""" + twin: "_models.DeviceTwinInfo" = rest_field() + """Information about the device twin, which is the cloud representation of application device + metadata. Required.""" + + @overload + def __init__( + self, + *, + twin: "_models.DeviceTwinInfo", + device_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTelemetryEventProperties(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a device telemetry event + (DeviceTelemetry). + + + :ivar body: The content of the message from the device. Required. + :vartype body: dict[str, any] + :ivar properties: Application properties are user-defined strings that can be added to the + message. These fields are optional. Required. + :vartype properties: dict[str, str] + :ivar system_properties: System properties help identify contents and source of the messages. + Required. + :vartype system_properties: dict[str, str] + """ + + body: Dict[str, Any] = rest_field() + """The content of the message from the device. Required.""" + properties: Dict[str, str] = rest_field() + """Application properties are user-defined strings that can be added to the message. These fields + are optional. Required.""" + system_properties: Dict[str, str] = rest_field(name="systemProperties") + """System properties help identify contents and source of the messages. Required.""" + + @overload + def __init__( + self, + *, + body: Dict[str, Any], + properties: Dict[str, str], + system_properties: Dict[str, str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTwinInfo(_model_base.Model): + """Information about the device twin, which is the cloud representation of application device + metadata. + + + :ivar authentication_type: Authentication type used for this device: either SAS, SelfSigned, or + CertificateAuthority. + :vartype authentication_type: str + :ivar cloud_to_device_message_count: Count of cloud to device messages sent to this device. + :vartype cloud_to_device_message_count: float + :ivar connection_state: Whether the device is connected or disconnected. + :vartype connection_state: str + :ivar device_id: The unique identifier of the device twin. + :vartype device_id: str + :ivar etag: A piece of information that describes the content of the device twin. Each etag is + guaranteed to be unique per device twin. + :vartype etag: str + :ivar last_activity_time: The ISO8601 timestamp of the last activity. + :vartype last_activity_time: str + :ivar properties: Properties JSON element. Required. + :vartype properties: ~azure.eventgrid.models.DeviceTwinInfoProperties + :ivar status: Whether the device twin is enabled or disabled. + :vartype status: str + :ivar status_update_time: The ISO8601 timestamp of the last device twin status update. + :vartype status_update_time: str + :ivar version: An integer that is incremented by one each time the device twin is updated. + :vartype version: float + :ivar x509_thumbprint: The thumbprint is a unique value for the x509 certificate, commonly used + to find a particular certificate in a certificate store. The thumbprint is dynamically + generated using the SHA1 algorithm, and does not physically exist in the certificate. Required. + :vartype x509_thumbprint: ~azure.eventgrid.models.DeviceTwinInfoX509Thumbprint + """ + + authentication_type: Optional[str] = rest_field(name="authenticationType") + """Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority.""" + cloud_to_device_message_count: Optional[float] = rest_field(name="cloudToDeviceMessageCount") + """Count of cloud to device messages sent to this device.""" + connection_state: Optional[str] = rest_field(name="connectionState") + """Whether the device is connected or disconnected.""" + device_id: Optional[str] = rest_field(name="deviceId") + """The unique identifier of the device twin.""" + etag: Optional[str] = rest_field() + """A piece of information that describes the content of the device twin. Each etag is guaranteed + to be unique per device twin.""" + last_activity_time: Optional[str] = rest_field(name="lastActivityTime") + """The ISO8601 timestamp of the last activity.""" + properties: "_models.DeviceTwinInfoProperties" = rest_field() + """Properties JSON element. Required.""" + status: Optional[str] = rest_field() + """Whether the device twin is enabled or disabled.""" + status_update_time: Optional[str] = rest_field(name="statusUpdateTime") + """The ISO8601 timestamp of the last device twin status update.""" + version: Optional[float] = rest_field() + """An integer that is incremented by one each time the device twin is updated.""" + x509_thumbprint: "_models.DeviceTwinInfoX509Thumbprint" = rest_field(name="x509Thumbprint") + """The thumbprint is a unique value for the x509 certificate, commonly used to find a particular + certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 + algorithm, and does not physically exist in the certificate. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.DeviceTwinInfoProperties", + x509_thumbprint: "_models.DeviceTwinInfoX509Thumbprint", + authentication_type: Optional[str] = None, + cloud_to_device_message_count: Optional[float] = None, + connection_state: Optional[str] = None, + device_id: Optional[str] = None, + etag: Optional[str] = None, + last_activity_time: Optional[str] = None, + status: Optional[str] = None, + status_update_time: Optional[str] = None, + version: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTwinInfoProperties(_model_base.Model): + """Properties JSON element. + + + :ivar desired: A portion of the properties that can be written only by the application + back-end, and read by the device. Required. + :vartype desired: ~azure.eventgrid.models.DeviceTwinProperties + :ivar reported: A portion of the properties that can be written only by the device, and read by + the application back-end. Required. + :vartype reported: ~azure.eventgrid.models.DeviceTwinProperties + """ + + desired: "_models.DeviceTwinProperties" = rest_field() + """A portion of the properties that can be written only by the application back-end, and read by + the device. Required.""" + reported: "_models.DeviceTwinProperties" = rest_field() + """A portion of the properties that can be written only by the device, and read by the application + back-end. Required.""" + + @overload + def __init__( + self, + *, + desired: "_models.DeviceTwinProperties", + reported: "_models.DeviceTwinProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTwinInfoX509Thumbprint(_model_base.Model): + """The thumbprint is a unique value for the x509 certificate, commonly used to find a particular + certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 + algorithm, and does not physically exist in the certificate. + + :ivar primary_thumbprint: Primary thumbprint for the x509 certificate. + :vartype primary_thumbprint: str + :ivar secondary_thumbprint: Secondary thumbprint for the x509 certificate. + :vartype secondary_thumbprint: str + """ + + primary_thumbprint: Optional[str] = rest_field(name="primaryThumbprint") + """Primary thumbprint for the x509 certificate.""" + secondary_thumbprint: Optional[str] = rest_field(name="secondaryThumbprint") + """Secondary thumbprint for the x509 certificate.""" + + @overload + def __init__( + self, + *, + primary_thumbprint: Optional[str] = None, + secondary_thumbprint: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTwinMetadata(_model_base.Model): + """Metadata information for the properties JSON document. + + :ivar last_updated: The ISO8601 timestamp of the last time the properties were updated. + :vartype last_updated: str + """ + + last_updated: Optional[str] = rest_field(name="lastUpdated") + """The ISO8601 timestamp of the last time the properties were updated.""" + + @overload + def __init__( + self, + *, + last_updated: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeviceTwinProperties(_model_base.Model): + """A portion of the properties that can be written only by the application back-end, and read by + the device. + + + :ivar metadata: Metadata information for the properties JSON document. Required. + :vartype metadata: ~azure.eventgrid.models.DeviceTwinMetadata + :ivar version: Version of device twin properties. + :vartype version: float + """ + + metadata: "_models.DeviceTwinMetadata" = rest_field() + """Metadata information for the properties JSON document. Required.""" + version: Optional[float] = rest_field() + """Version of device twin properties.""" + + @overload + def __init__( + self, + *, + metadata: "_models.DeviceTwinMetadata", + version: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridMQTTClientEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for MQTT Client state changes. + + :ivar client_authentication_name: Unique identifier for the MQTT client that the client + presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters. + :vartype client_authentication_name: str + :ivar client_name: Name of the client resource in the Event Grid namespace. + :vartype client_name: str + :ivar namespace_name: Name of the Event Grid namespace where the MQTT client was created or + updated. + :vartype namespace_name: str + """ + + client_authentication_name: Optional[str] = rest_field(name="clientAuthenticationName") + """Unique identifier for the MQTT client that the client presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters.""" + client_name: Optional[str] = rest_field(name="clientName") + """Name of the client resource in the Event Grid namespace.""" + namespace_name: Optional[str] = rest_field(name="namespaceName") + """Name of the Event Grid namespace where the MQTT client was created or updated.""" + + @overload + def __init__( + self, + *, + client_authentication_name: Optional[str] = None, + client_name: Optional[str] = None, + namespace_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridMQTTClientCreatedOrUpdatedEventData(EventGridMQTTClientEventData): # pylint: disable=name-too-long + """Event data for Microsoft.EventGrid.MQTTClientCreatedOrUpdated event. + + + :ivar client_authentication_name: Unique identifier for the MQTT client that the client + presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters. + :vartype client_authentication_name: str + :ivar client_name: Name of the client resource in the Event Grid namespace. + :vartype client_name: str + :ivar namespace_name: Name of the Event Grid namespace where the MQTT client was created or + updated. + :vartype namespace_name: str + :ivar state: Configured state of the client. The value could be Enabled or Disabled. Required. + Known values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.eventgrid.models.EventGridMQTTClientState + :ivar created_on: Time the client resource is created based on the provider's UTC time. + Required. + :vartype created_on: ~datetime.datetime + :ivar updated_on: Time the client resource is last updated based on the provider's UTC time. If + the client resource was never updated, this value is identical to the value of + the 'createdOn' property. Required. + :vartype updated_on: ~datetime.datetime + :ivar attributes: The key-value attributes that are assigned to the client resource. Required. + :vartype attributes: dict[str, str] + """ + + state: Union[str, "_models.EventGridMQTTClientState"] = rest_field() + """Configured state of the client. The value could be Enabled or Disabled. Required. Known values + are: \"Enabled\" and \"Disabled\".""" + created_on: datetime.datetime = rest_field(name="createdOn", format="rfc3339") + """Time the client resource is created based on the provider's UTC time. Required.""" + updated_on: datetime.datetime = rest_field(name="updatedOn", format="rfc3339") + """Time the client resource is last updated based on the provider's UTC time. If + the client resource was never updated, this value is identical to the value of + the 'createdOn' property. Required.""" + attributes: Dict[str, str] = rest_field() + """The key-value attributes that are assigned to the client resource. Required.""" + + @overload + def __init__( + self, + *, + state: Union[str, "_models.EventGridMQTTClientState"], + created_on: datetime.datetime, + updated_on: datetime.datetime, + attributes: Dict[str, str], + client_authentication_name: Optional[str] = None, + client_name: Optional[str] = None, + namespace_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridMQTTClientDeletedEventData(EventGridMQTTClientEventData): + """Event data for Microsoft.EventGrid.MQTTClientDeleted event. + + :ivar client_authentication_name: Unique identifier for the MQTT client that the client + presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters. + :vartype client_authentication_name: str + :ivar client_name: Name of the client resource in the Event Grid namespace. + :vartype client_name: str + :ivar namespace_name: Name of the Event Grid namespace where the MQTT client was created or + updated. + :vartype namespace_name: str + """ + + @overload + def __init__( + self, + *, + client_authentication_name: Optional[str] = None, + client_name: Optional[str] = None, + namespace_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridMQTTClientSessionConnectedEventData(EventGridMQTTClientEventData): # pylint: disable=name-too-long + """Event data for Microsoft.EventGrid.MQTTClientSessionConnected event. + + :ivar client_authentication_name: Unique identifier for the MQTT client that the client + presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters. + :vartype client_authentication_name: str + :ivar client_name: Name of the client resource in the Event Grid namespace. + :vartype client_name: str + :ivar namespace_name: Name of the Event Grid namespace where the MQTT client was created or + updated. + :vartype namespace_name: str + :ivar client_session_name: Unique identifier for the MQTT client's session. This case-sensitive + string can + be up to 128 characters long, and supports UTF-8 characters. + :vartype client_session_name: str + :ivar sequence_number: A number that helps indicate order of MQTT client session connected or + disconnected events. Latest event will have a sequence number that is higher + than the previous event. + :vartype sequence_number: int + """ + + client_session_name: Optional[str] = rest_field(name="clientSessionName") + """Unique identifier for the MQTT client's session. This case-sensitive string can + be up to 128 characters long, and supports UTF-8 characters.""" + sequence_number: Optional[int] = rest_field(name="sequenceNumber") + """A number that helps indicate order of MQTT client session connected or + disconnected events. Latest event will have a sequence number that is higher + than the previous event.""" + + @overload + def __init__( + self, + *, + client_authentication_name: Optional[str] = None, + client_name: Optional[str] = None, + namespace_name: Optional[str] = None, + client_session_name: Optional[str] = None, + sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventGridMQTTClientSessionDisconnectedEventData(EventGridMQTTClientEventData): # pylint: disable=name-too-long + """Event data for Microsoft.EventGrid.MQTTClientSessionDisconnected event. + + + :ivar client_authentication_name: Unique identifier for the MQTT client that the client + presents to the service + for authentication. This case-sensitive string can be up to 128 characters + long, and supports UTF-8 characters. + :vartype client_authentication_name: str + :ivar client_name: Name of the client resource in the Event Grid namespace. + :vartype client_name: str + :ivar namespace_name: Name of the Event Grid namespace where the MQTT client was created or + updated. + :vartype namespace_name: str + :ivar client_session_name: Unique identifier for the MQTT client's session. This case-sensitive + string can + be up to 128 characters long, and supports UTF-8 characters. + :vartype client_session_name: str + :ivar sequence_number: A number that helps indicate order of MQTT client session connected or + disconnected events. Latest event will have a sequence number that is higher + than the previous event. + :vartype sequence_number: int + :ivar disconnection_reason: Reason for the disconnection of the MQTT client's session. The + value could be + one of the values in the disconnection reasons table. Required. Known values are: + "ClientAuthenticationError", "ClientAuthorizationError", "ClientError", + "ClientInitiatedDisconnect", "ConnectionLost", "IpForbidden", "QuotaExceeded", "ServerError", + "ServerInitiatedDisconnect", "SessionOverflow", and "SessionTakenOver". + :vartype disconnection_reason: str or + ~azure.eventgrid.models.EventGridMQTTClientDisconnectionReason + """ + + client_session_name: Optional[str] = rest_field(name="clientSessionName") + """Unique identifier for the MQTT client's session. This case-sensitive string can + be up to 128 characters long, and supports UTF-8 characters.""" + sequence_number: Optional[int] = rest_field(name="sequenceNumber") + """A number that helps indicate order of MQTT client session connected or + disconnected events. Latest event will have a sequence number that is higher + than the previous event.""" + disconnection_reason: Union[str, "_models.EventGridMQTTClientDisconnectionReason"] = rest_field( + name="disconnectionReason" + ) + """Reason for the disconnection of the MQTT client's session. The value could be + one of the values in the disconnection reasons table. Required. Known values are: + \"ClientAuthenticationError\", \"ClientAuthorizationError\", \"ClientError\", + \"ClientInitiatedDisconnect\", \"ConnectionLost\", \"IpForbidden\", \"QuotaExceeded\", + \"ServerError\", \"ServerInitiatedDisconnect\", \"SessionOverflow\", and \"SessionTakenOver\".""" + + @overload + def __init__( + self, + *, + disconnection_reason: Union[str, "_models.EventGridMQTTClientDisconnectionReason"], + client_authentication_name: Optional[str] = None, + client_name: Optional[str] = None, + namespace_name: Optional[str] = None, + client_session_name: Optional[str] = None, + sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventHubCaptureFileCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.EventHub.CaptureFileCreated + event. + + + :ivar file_url: The path to the capture file. + :vartype file_url: str + :ivar file_type: The file type of the capture file. + :vartype file_type: str + :ivar partition_id: The shard ID. + :vartype partition_id: str + :ivar size_in_bytes: The file size. + :vartype size_in_bytes: int + :ivar event_count: The number of events in the file. + :vartype event_count: int + :ivar first_sequence_number: The smallest sequence number from the queue. + :vartype first_sequence_number: int + :ivar last_sequence_number: The last sequence number from the queue. + :vartype last_sequence_number: int + :ivar first_enqueue_time: The first time from the queue. Required. + :vartype first_enqueue_time: ~datetime.datetime + :ivar last_enqueue_time: The last time from the queue. Required. + :vartype last_enqueue_time: ~datetime.datetime + """ + + file_url: Optional[str] = rest_field(name="fileUrl") + """The path to the capture file.""" + file_type: Optional[str] = rest_field(name="fileType") + """The file type of the capture file.""" + partition_id: Optional[str] = rest_field(name="partitionId") + """The shard ID.""" + size_in_bytes: Optional[int] = rest_field(name="sizeInBytes") + """The file size.""" + event_count: Optional[int] = rest_field(name="eventCount") + """The number of events in the file.""" + first_sequence_number: Optional[int] = rest_field(name="firstSequenceNumber") + """The smallest sequence number from the queue.""" + last_sequence_number: Optional[int] = rest_field(name="lastSequenceNumber") + """The last sequence number from the queue.""" + first_enqueue_time: datetime.datetime = rest_field(name="firstEnqueueTime", format="rfc3339") + """The first time from the queue. Required.""" + last_enqueue_time: datetime.datetime = rest_field(name="lastEnqueueTime", format="rfc3339") + """The last time from the queue. Required.""" + + @overload + def __init__( + self, + *, + first_enqueue_time: datetime.datetime, + last_enqueue_time: datetime.datetime, + file_url: Optional[str] = None, + file_type: Optional[str] = None, + partition_id: Optional[str] = None, + size_in_bytes: Optional[int] = None, + event_count: Optional[int] = None, + first_sequence_number: Optional[int] = None, + last_sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareDicomImageCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.DicomImageCreated event. + + :ivar partition_name: Data partition name. + :vartype partition_name: str + :ivar image_study_instance_uid: Unique identifier for the Study. + :vartype image_study_instance_uid: str + :ivar image_series_instance_uid: Unique identifier for the Series. + :vartype image_series_instance_uid: str + :ivar image_sop_instance_uid: Unique identifier for the DICOM Image. + :vartype image_sop_instance_uid: str + :ivar service_host_name: Domain name of the DICOM account for this image. + :vartype service_host_name: str + :ivar sequence_number: Sequence number of the DICOM Service within Azure Health Data Services. + It is unique for every image creation and deletion within the service. + :vartype sequence_number: int + """ + + partition_name: Optional[str] = rest_field(name="partitionName") + """Data partition name.""" + image_study_instance_uid: Optional[str] = rest_field(name="imageStudyInstanceUid") + """Unique identifier for the Study.""" + image_series_instance_uid: Optional[str] = rest_field(name="imageSeriesInstanceUid") + """Unique identifier for the Series.""" + image_sop_instance_uid: Optional[str] = rest_field(name="imageSopInstanceUid") + """Unique identifier for the DICOM Image.""" + service_host_name: Optional[str] = rest_field(name="serviceHostName") + """Domain name of the DICOM account for this image.""" + sequence_number: Optional[int] = rest_field(name="sequenceNumber") + """Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every + image creation and deletion within the service.""" + + @overload + def __init__( + self, + *, + partition_name: Optional[str] = None, + image_study_instance_uid: Optional[str] = None, + image_series_instance_uid: Optional[str] = None, + image_sop_instance_uid: Optional[str] = None, + service_host_name: Optional[str] = None, + sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareDicomImageDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.DicomImageDeleted event. + + :ivar partition_name: Data partition name. + :vartype partition_name: str + :ivar image_study_instance_uid: Unique identifier for the Study. + :vartype image_study_instance_uid: str + :ivar image_series_instance_uid: Unique identifier for the Series. + :vartype image_series_instance_uid: str + :ivar image_sop_instance_uid: Unique identifier for the DICOM Image. + :vartype image_sop_instance_uid: str + :ivar service_host_name: Host name of the DICOM account for this image. + :vartype service_host_name: str + :ivar sequence_number: Sequence number of the DICOM Service within Azure Health Data Services. + It is unique for every image creation and deletion within the service. + :vartype sequence_number: int + """ + + partition_name: Optional[str] = rest_field(name="partitionName") + """Data partition name.""" + image_study_instance_uid: Optional[str] = rest_field(name="imageStudyInstanceUid") + """Unique identifier for the Study.""" + image_series_instance_uid: Optional[str] = rest_field(name="imageSeriesInstanceUid") + """Unique identifier for the Series.""" + image_sop_instance_uid: Optional[str] = rest_field(name="imageSopInstanceUid") + """Unique identifier for the DICOM Image.""" + service_host_name: Optional[str] = rest_field(name="serviceHostName") + """Host name of the DICOM account for this image.""" + sequence_number: Optional[int] = rest_field(name="sequenceNumber") + """Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every + image creation and deletion within the service.""" + + @overload + def __init__( + self, + *, + partition_name: Optional[str] = None, + image_study_instance_uid: Optional[str] = None, + image_series_instance_uid: Optional[str] = None, + image_sop_instance_uid: Optional[str] = None, + service_host_name: Optional[str] = None, + sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareDicomImageUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.DicomImageUpdated event. + + :ivar partition_name: Data partition name. + :vartype partition_name: str + :ivar image_study_instance_uid: Unique identifier for the Study. + :vartype image_study_instance_uid: str + :ivar image_series_instance_uid: Unique identifier for the Series. + :vartype image_series_instance_uid: str + :ivar image_sop_instance_uid: Unique identifier for the DICOM Image. + :vartype image_sop_instance_uid: str + :ivar service_host_name: Domain name of the DICOM account for this image. + :vartype service_host_name: str + :ivar sequence_number: Sequence number of the DICOM Service within Azure Health Data Services. + It is unique for every image creation, updation and deletion within the service. + :vartype sequence_number: int + """ + + partition_name: Optional[str] = rest_field(name="partitionName") + """Data partition name.""" + image_study_instance_uid: Optional[str] = rest_field(name="imageStudyInstanceUid") + """Unique identifier for the Study.""" + image_series_instance_uid: Optional[str] = rest_field(name="imageSeriesInstanceUid") + """Unique identifier for the Series.""" + image_sop_instance_uid: Optional[str] = rest_field(name="imageSopInstanceUid") + """Unique identifier for the DICOM Image.""" + service_host_name: Optional[str] = rest_field(name="serviceHostName") + """Domain name of the DICOM account for this image.""" + sequence_number: Optional[int] = rest_field(name="sequenceNumber") + """Sequence number of the DICOM Service within Azure Health Data Services. It is unique for every + image creation, updation and deletion within the service.""" + + @overload + def __init__( + self, + *, + partition_name: Optional[str] = None, + image_study_instance_uid: Optional[str] = None, + image_series_instance_uid: Optional[str] = None, + image_sop_instance_uid: Optional[str] = None, + service_host_name: Optional[str] = None, + sequence_number: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareFhirResourceCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.FhirResourceCreated event. + + + :ivar resource_type: Type of HL7 FHIR resource. Required. Known values are: "Account", + "ActivityDefinition", "AdverseEvent", "AllergyIntolerance", "Appointment", + "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BiologicallyDerivedProduct", + "BodySite", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", + "CatalogEntry", "ChargeItem", "ChargeItemDefinition", "Claim", "ClaimResponse", + "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", + "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", + "Coverage", "CoverageEligibilityRequest", "CoverageEligibilityResponse", "DataElement", + "DetectedIssue", "Device", "DeviceComponent", "DeviceDefinition", "DeviceMetric", + "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", + "DocumentReference", "DomainResource", "EffectEvidenceSynthesis", "EligibilityRequest", + "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", + "EpisodeOfCare", "EventDefinition", "Evidence", "EvidenceVariable", "ExampleScenario", + "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", + "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", + "ImagingStudy", "Immunization", "ImmunizationEvaluation", "ImmunizationRecommendation", + "ImplementationGuide", "InsurancePlan", "Invoice", "Library", "Linkage", "List", "Location", + "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", + "MedicationDispense", "MedicationKnowledge", "MedicationRequest", "MedicationStatement", + "MedicinalProduct", "MedicinalProductAuthorization", "MedicinalProductContraindication", + "MedicinalProductIndication", "MedicinalProductIngredient", "MedicinalProductInteraction", + "MedicinalProductManufactured", "MedicinalProductPackaged", "MedicinalProductPharmaceutical", + "MedicinalProductUndesirableEffect", "MessageDefinition", "MessageHeader", "MolecularSequence", + "NamingSystem", "NutritionOrder", "Observation", "ObservationDefinition", + "OperationDefinition", "OperationOutcome", "Organization", "OrganizationAffiliation", + "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", + "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", + "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", + "RelatedPerson", "RequestGroup", "ResearchDefinition", "ResearchElementDefinition", + "ResearchStudy", "ResearchSubject", "Resource", "RiskAssessment", "RiskEvidenceSynthesis", + "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "ServiceRequest", "Slot", + "Specimen", "SpecimenDefinition", "StructureDefinition", "StructureMap", "Subscription", + "Substance", "SubstanceNucleicAcid", "SubstancePolymer", "SubstanceProtein", + "SubstanceReferenceInformation", "SubstanceSourceMaterial", "SubstanceSpecification", + "SupplyDelivery", "SupplyRequest", "Task", "TerminologyCapabilities", "TestReport", + "TestScript", "ValueSet", "VerificationResult", and "VisionPrescription". + :vartype resource_type: str or ~azure.eventgrid.models.HealthcareFhirResourceType + :ivar resource_fhir_account: Domain name of FHIR account for this resource. + :vartype resource_fhir_account: str + :ivar resource_fhir_id: Id of HL7 FHIR resource. + :vartype resource_fhir_id: str + :ivar resource_version_id: VersionId of HL7 FHIR resource. It changes when the resource is + created, updated, or deleted(soft-deletion). + :vartype resource_version_id: int + """ + + resource_type: Union[str, "_models.HealthcareFhirResourceType"] = rest_field(name="resourceType") + """Type of HL7 FHIR resource. Required. Known values are: \"Account\", \"ActivityDefinition\", + \"AdverseEvent\", \"AllergyIntolerance\", \"Appointment\", \"AppointmentResponse\", + \"AuditEvent\", \"Basic\", \"Binary\", \"BiologicallyDerivedProduct\", \"BodySite\", + \"BodyStructure\", \"Bundle\", \"CapabilityStatement\", \"CarePlan\", \"CareTeam\", + \"CatalogEntry\", \"ChargeItem\", \"ChargeItemDefinition\", \"Claim\", \"ClaimResponse\", + \"ClinicalImpression\", \"CodeSystem\", \"Communication\", \"CommunicationRequest\", + \"CompartmentDefinition\", \"Composition\", \"ConceptMap\", \"Condition\", \"Consent\", + \"Contract\", \"Coverage\", \"CoverageEligibilityRequest\", \"CoverageEligibilityResponse\", + \"DataElement\", \"DetectedIssue\", \"Device\", \"DeviceComponent\", \"DeviceDefinition\", + \"DeviceMetric\", \"DeviceRequest\", \"DeviceUseStatement\", \"DiagnosticReport\", + \"DocumentManifest\", \"DocumentReference\", \"DomainResource\", \"EffectEvidenceSynthesis\", + \"EligibilityRequest\", \"EligibilityResponse\", \"Encounter\", \"Endpoint\", + \"EnrollmentRequest\", \"EnrollmentResponse\", \"EpisodeOfCare\", \"EventDefinition\", + \"Evidence\", \"EvidenceVariable\", \"ExampleScenario\", \"ExpansionProfile\", + \"ExplanationOfBenefit\", \"FamilyMemberHistory\", \"Flag\", \"Goal\", \"GraphDefinition\", + \"Group\", \"GuidanceResponse\", \"HealthcareService\", \"ImagingManifest\", \"ImagingStudy\", + \"Immunization\", \"ImmunizationEvaluation\", \"ImmunizationRecommendation\", + \"ImplementationGuide\", \"InsurancePlan\", \"Invoice\", \"Library\", \"Linkage\", \"List\", + \"Location\", \"Measure\", \"MeasureReport\", \"Media\", \"Medication\", + \"MedicationAdministration\", \"MedicationDispense\", \"MedicationKnowledge\", + \"MedicationRequest\", \"MedicationStatement\", \"MedicinalProduct\", + \"MedicinalProductAuthorization\", \"MedicinalProductContraindication\", + \"MedicinalProductIndication\", \"MedicinalProductIngredient\", + \"MedicinalProductInteraction\", \"MedicinalProductManufactured\", + \"MedicinalProductPackaged\", \"MedicinalProductPharmaceutical\", + \"MedicinalProductUndesirableEffect\", \"MessageDefinition\", \"MessageHeader\", + \"MolecularSequence\", \"NamingSystem\", \"NutritionOrder\", \"Observation\", + \"ObservationDefinition\", \"OperationDefinition\", \"OperationOutcome\", \"Organization\", + \"OrganizationAffiliation\", \"Parameters\", \"Patient\", \"PaymentNotice\", + \"PaymentReconciliation\", \"Person\", \"PlanDefinition\", \"Practitioner\", + \"PractitionerRole\", \"Procedure\", \"ProcedureRequest\", \"ProcessRequest\", + \"ProcessResponse\", \"Provenance\", \"Questionnaire\", \"QuestionnaireResponse\", + \"ReferralRequest\", \"RelatedPerson\", \"RequestGroup\", \"ResearchDefinition\", + \"ResearchElementDefinition\", \"ResearchStudy\", \"ResearchSubject\", \"Resource\", + \"RiskAssessment\", \"RiskEvidenceSynthesis\", \"Schedule\", \"SearchParameter\", \"Sequence\", + \"ServiceDefinition\", \"ServiceRequest\", \"Slot\", \"Specimen\", \"SpecimenDefinition\", + \"StructureDefinition\", \"StructureMap\", \"Subscription\", \"Substance\", + \"SubstanceNucleicAcid\", \"SubstancePolymer\", \"SubstanceProtein\", + \"SubstanceReferenceInformation\", \"SubstanceSourceMaterial\", \"SubstanceSpecification\", + \"SupplyDelivery\", \"SupplyRequest\", \"Task\", \"TerminologyCapabilities\", \"TestReport\", + \"TestScript\", \"ValueSet\", \"VerificationResult\", and \"VisionPrescription\".""" + resource_fhir_account: Optional[str] = rest_field(name="resourceFhirAccount") + """Domain name of FHIR account for this resource.""" + resource_fhir_id: Optional[str] = rest_field(name="resourceFhirId") + """Id of HL7 FHIR resource.""" + resource_version_id: Optional[int] = rest_field(name="resourceVersionId") + """VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or + deleted(soft-deletion).""" + + @overload + def __init__( + self, + *, + resource_type: Union[str, "_models.HealthcareFhirResourceType"], + resource_fhir_account: Optional[str] = None, + resource_fhir_id: Optional[str] = None, + resource_version_id: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareFhirResourceDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.FhirResourceDeleted event. + + + :ivar resource_type: Type of HL7 FHIR resource. Required. Known values are: "Account", + "ActivityDefinition", "AdverseEvent", "AllergyIntolerance", "Appointment", + "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BiologicallyDerivedProduct", + "BodySite", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", + "CatalogEntry", "ChargeItem", "ChargeItemDefinition", "Claim", "ClaimResponse", + "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", + "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", + "Coverage", "CoverageEligibilityRequest", "CoverageEligibilityResponse", "DataElement", + "DetectedIssue", "Device", "DeviceComponent", "DeviceDefinition", "DeviceMetric", + "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", + "DocumentReference", "DomainResource", "EffectEvidenceSynthesis", "EligibilityRequest", + "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", + "EpisodeOfCare", "EventDefinition", "Evidence", "EvidenceVariable", "ExampleScenario", + "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", + "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", + "ImagingStudy", "Immunization", "ImmunizationEvaluation", "ImmunizationRecommendation", + "ImplementationGuide", "InsurancePlan", "Invoice", "Library", "Linkage", "List", "Location", + "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", + "MedicationDispense", "MedicationKnowledge", "MedicationRequest", "MedicationStatement", + "MedicinalProduct", "MedicinalProductAuthorization", "MedicinalProductContraindication", + "MedicinalProductIndication", "MedicinalProductIngredient", "MedicinalProductInteraction", + "MedicinalProductManufactured", "MedicinalProductPackaged", "MedicinalProductPharmaceutical", + "MedicinalProductUndesirableEffect", "MessageDefinition", "MessageHeader", "MolecularSequence", + "NamingSystem", "NutritionOrder", "Observation", "ObservationDefinition", + "OperationDefinition", "OperationOutcome", "Organization", "OrganizationAffiliation", + "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", + "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", + "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", + "RelatedPerson", "RequestGroup", "ResearchDefinition", "ResearchElementDefinition", + "ResearchStudy", "ResearchSubject", "Resource", "RiskAssessment", "RiskEvidenceSynthesis", + "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "ServiceRequest", "Slot", + "Specimen", "SpecimenDefinition", "StructureDefinition", "StructureMap", "Subscription", + "Substance", "SubstanceNucleicAcid", "SubstancePolymer", "SubstanceProtein", + "SubstanceReferenceInformation", "SubstanceSourceMaterial", "SubstanceSpecification", + "SupplyDelivery", "SupplyRequest", "Task", "TerminologyCapabilities", "TestReport", + "TestScript", "ValueSet", "VerificationResult", and "VisionPrescription". + :vartype resource_type: str or ~azure.eventgrid.models.HealthcareFhirResourceType + :ivar resource_fhir_account: Domain name of FHIR account for this resource. + :vartype resource_fhir_account: str + :ivar resource_fhir_id: Id of HL7 FHIR resource. + :vartype resource_fhir_id: str + :ivar resource_version_id: VersionId of HL7 FHIR resource. It changes when the resource is + created, updated, or deleted(soft-deletion). + :vartype resource_version_id: int + """ + + resource_type: Union[str, "_models.HealthcareFhirResourceType"] = rest_field(name="resourceType") + """Type of HL7 FHIR resource. Required. Known values are: \"Account\", \"ActivityDefinition\", + \"AdverseEvent\", \"AllergyIntolerance\", \"Appointment\", \"AppointmentResponse\", + \"AuditEvent\", \"Basic\", \"Binary\", \"BiologicallyDerivedProduct\", \"BodySite\", + \"BodyStructure\", \"Bundle\", \"CapabilityStatement\", \"CarePlan\", \"CareTeam\", + \"CatalogEntry\", \"ChargeItem\", \"ChargeItemDefinition\", \"Claim\", \"ClaimResponse\", + \"ClinicalImpression\", \"CodeSystem\", \"Communication\", \"CommunicationRequest\", + \"CompartmentDefinition\", \"Composition\", \"ConceptMap\", \"Condition\", \"Consent\", + \"Contract\", \"Coverage\", \"CoverageEligibilityRequest\", \"CoverageEligibilityResponse\", + \"DataElement\", \"DetectedIssue\", \"Device\", \"DeviceComponent\", \"DeviceDefinition\", + \"DeviceMetric\", \"DeviceRequest\", \"DeviceUseStatement\", \"DiagnosticReport\", + \"DocumentManifest\", \"DocumentReference\", \"DomainResource\", \"EffectEvidenceSynthesis\", + \"EligibilityRequest\", \"EligibilityResponse\", \"Encounter\", \"Endpoint\", + \"EnrollmentRequest\", \"EnrollmentResponse\", \"EpisodeOfCare\", \"EventDefinition\", + \"Evidence\", \"EvidenceVariable\", \"ExampleScenario\", \"ExpansionProfile\", + \"ExplanationOfBenefit\", \"FamilyMemberHistory\", \"Flag\", \"Goal\", \"GraphDefinition\", + \"Group\", \"GuidanceResponse\", \"HealthcareService\", \"ImagingManifest\", \"ImagingStudy\", + \"Immunization\", \"ImmunizationEvaluation\", \"ImmunizationRecommendation\", + \"ImplementationGuide\", \"InsurancePlan\", \"Invoice\", \"Library\", \"Linkage\", \"List\", + \"Location\", \"Measure\", \"MeasureReport\", \"Media\", \"Medication\", + \"MedicationAdministration\", \"MedicationDispense\", \"MedicationKnowledge\", + \"MedicationRequest\", \"MedicationStatement\", \"MedicinalProduct\", + \"MedicinalProductAuthorization\", \"MedicinalProductContraindication\", + \"MedicinalProductIndication\", \"MedicinalProductIngredient\", + \"MedicinalProductInteraction\", \"MedicinalProductManufactured\", + \"MedicinalProductPackaged\", \"MedicinalProductPharmaceutical\", + \"MedicinalProductUndesirableEffect\", \"MessageDefinition\", \"MessageHeader\", + \"MolecularSequence\", \"NamingSystem\", \"NutritionOrder\", \"Observation\", + \"ObservationDefinition\", \"OperationDefinition\", \"OperationOutcome\", \"Organization\", + \"OrganizationAffiliation\", \"Parameters\", \"Patient\", \"PaymentNotice\", + \"PaymentReconciliation\", \"Person\", \"PlanDefinition\", \"Practitioner\", + \"PractitionerRole\", \"Procedure\", \"ProcedureRequest\", \"ProcessRequest\", + \"ProcessResponse\", \"Provenance\", \"Questionnaire\", \"QuestionnaireResponse\", + \"ReferralRequest\", \"RelatedPerson\", \"RequestGroup\", \"ResearchDefinition\", + \"ResearchElementDefinition\", \"ResearchStudy\", \"ResearchSubject\", \"Resource\", + \"RiskAssessment\", \"RiskEvidenceSynthesis\", \"Schedule\", \"SearchParameter\", \"Sequence\", + \"ServiceDefinition\", \"ServiceRequest\", \"Slot\", \"Specimen\", \"SpecimenDefinition\", + \"StructureDefinition\", \"StructureMap\", \"Subscription\", \"Substance\", + \"SubstanceNucleicAcid\", \"SubstancePolymer\", \"SubstanceProtein\", + \"SubstanceReferenceInformation\", \"SubstanceSourceMaterial\", \"SubstanceSpecification\", + \"SupplyDelivery\", \"SupplyRequest\", \"Task\", \"TerminologyCapabilities\", \"TestReport\", + \"TestScript\", \"ValueSet\", \"VerificationResult\", and \"VisionPrescription\".""" + resource_fhir_account: Optional[str] = rest_field(name="resourceFhirAccount") + """Domain name of FHIR account for this resource.""" + resource_fhir_id: Optional[str] = rest_field(name="resourceFhirId") + """Id of HL7 FHIR resource.""" + resource_version_id: Optional[int] = rest_field(name="resourceVersionId") + """VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or + deleted(soft-deletion).""" + + @overload + def __init__( + self, + *, + resource_type: Union[str, "_models.HealthcareFhirResourceType"], + resource_fhir_account: Optional[str] = None, + resource_fhir_id: Optional[str] = None, + resource_version_id: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HealthcareFhirResourceUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.HealthcareApis.FhirResourceUpdated event. + + + :ivar resource_type: Type of HL7 FHIR resource. Required. Known values are: "Account", + "ActivityDefinition", "AdverseEvent", "AllergyIntolerance", "Appointment", + "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BiologicallyDerivedProduct", + "BodySite", "BodyStructure", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", + "CatalogEntry", "ChargeItem", "ChargeItemDefinition", "Claim", "ClaimResponse", + "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", + "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", + "Coverage", "CoverageEligibilityRequest", "CoverageEligibilityResponse", "DataElement", + "DetectedIssue", "Device", "DeviceComponent", "DeviceDefinition", "DeviceMetric", + "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", + "DocumentReference", "DomainResource", "EffectEvidenceSynthesis", "EligibilityRequest", + "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", + "EpisodeOfCare", "EventDefinition", "Evidence", "EvidenceVariable", "ExampleScenario", + "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", + "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", + "ImagingStudy", "Immunization", "ImmunizationEvaluation", "ImmunizationRecommendation", + "ImplementationGuide", "InsurancePlan", "Invoice", "Library", "Linkage", "List", "Location", + "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", + "MedicationDispense", "MedicationKnowledge", "MedicationRequest", "MedicationStatement", + "MedicinalProduct", "MedicinalProductAuthorization", "MedicinalProductContraindication", + "MedicinalProductIndication", "MedicinalProductIngredient", "MedicinalProductInteraction", + "MedicinalProductManufactured", "MedicinalProductPackaged", "MedicinalProductPharmaceutical", + "MedicinalProductUndesirableEffect", "MessageDefinition", "MessageHeader", "MolecularSequence", + "NamingSystem", "NutritionOrder", "Observation", "ObservationDefinition", + "OperationDefinition", "OperationOutcome", "Organization", "OrganizationAffiliation", + "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", + "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", + "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", + "RelatedPerson", "RequestGroup", "ResearchDefinition", "ResearchElementDefinition", + "ResearchStudy", "ResearchSubject", "Resource", "RiskAssessment", "RiskEvidenceSynthesis", + "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "ServiceRequest", "Slot", + "Specimen", "SpecimenDefinition", "StructureDefinition", "StructureMap", "Subscription", + "Substance", "SubstanceNucleicAcid", "SubstancePolymer", "SubstanceProtein", + "SubstanceReferenceInformation", "SubstanceSourceMaterial", "SubstanceSpecification", + "SupplyDelivery", "SupplyRequest", "Task", "TerminologyCapabilities", "TestReport", + "TestScript", "ValueSet", "VerificationResult", and "VisionPrescription". + :vartype resource_type: str or ~azure.eventgrid.models.HealthcareFhirResourceType + :ivar resource_fhir_account: Domain name of FHIR account for this resource. + :vartype resource_fhir_account: str + :ivar resource_fhir_id: Id of HL7 FHIR resource. + :vartype resource_fhir_id: str + :ivar resource_version_id: VersionId of HL7 FHIR resource. It changes when the resource is + created, updated, or deleted(soft-deletion). + :vartype resource_version_id: int + """ + + resource_type: Union[str, "_models.HealthcareFhirResourceType"] = rest_field(name="resourceType") + """Type of HL7 FHIR resource. Required. Known values are: \"Account\", \"ActivityDefinition\", + \"AdverseEvent\", \"AllergyIntolerance\", \"Appointment\", \"AppointmentResponse\", + \"AuditEvent\", \"Basic\", \"Binary\", \"BiologicallyDerivedProduct\", \"BodySite\", + \"BodyStructure\", \"Bundle\", \"CapabilityStatement\", \"CarePlan\", \"CareTeam\", + \"CatalogEntry\", \"ChargeItem\", \"ChargeItemDefinition\", \"Claim\", \"ClaimResponse\", + \"ClinicalImpression\", \"CodeSystem\", \"Communication\", \"CommunicationRequest\", + \"CompartmentDefinition\", \"Composition\", \"ConceptMap\", \"Condition\", \"Consent\", + \"Contract\", \"Coverage\", \"CoverageEligibilityRequest\", \"CoverageEligibilityResponse\", + \"DataElement\", \"DetectedIssue\", \"Device\", \"DeviceComponent\", \"DeviceDefinition\", + \"DeviceMetric\", \"DeviceRequest\", \"DeviceUseStatement\", \"DiagnosticReport\", + \"DocumentManifest\", \"DocumentReference\", \"DomainResource\", \"EffectEvidenceSynthesis\", + \"EligibilityRequest\", \"EligibilityResponse\", \"Encounter\", \"Endpoint\", + \"EnrollmentRequest\", \"EnrollmentResponse\", \"EpisodeOfCare\", \"EventDefinition\", + \"Evidence\", \"EvidenceVariable\", \"ExampleScenario\", \"ExpansionProfile\", + \"ExplanationOfBenefit\", \"FamilyMemberHistory\", \"Flag\", \"Goal\", \"GraphDefinition\", + \"Group\", \"GuidanceResponse\", \"HealthcareService\", \"ImagingManifest\", \"ImagingStudy\", + \"Immunization\", \"ImmunizationEvaluation\", \"ImmunizationRecommendation\", + \"ImplementationGuide\", \"InsurancePlan\", \"Invoice\", \"Library\", \"Linkage\", \"List\", + \"Location\", \"Measure\", \"MeasureReport\", \"Media\", \"Medication\", + \"MedicationAdministration\", \"MedicationDispense\", \"MedicationKnowledge\", + \"MedicationRequest\", \"MedicationStatement\", \"MedicinalProduct\", + \"MedicinalProductAuthorization\", \"MedicinalProductContraindication\", + \"MedicinalProductIndication\", \"MedicinalProductIngredient\", + \"MedicinalProductInteraction\", \"MedicinalProductManufactured\", + \"MedicinalProductPackaged\", \"MedicinalProductPharmaceutical\", + \"MedicinalProductUndesirableEffect\", \"MessageDefinition\", \"MessageHeader\", + \"MolecularSequence\", \"NamingSystem\", \"NutritionOrder\", \"Observation\", + \"ObservationDefinition\", \"OperationDefinition\", \"OperationOutcome\", \"Organization\", + \"OrganizationAffiliation\", \"Parameters\", \"Patient\", \"PaymentNotice\", + \"PaymentReconciliation\", \"Person\", \"PlanDefinition\", \"Practitioner\", + \"PractitionerRole\", \"Procedure\", \"ProcedureRequest\", \"ProcessRequest\", + \"ProcessResponse\", \"Provenance\", \"Questionnaire\", \"QuestionnaireResponse\", + \"ReferralRequest\", \"RelatedPerson\", \"RequestGroup\", \"ResearchDefinition\", + \"ResearchElementDefinition\", \"ResearchStudy\", \"ResearchSubject\", \"Resource\", + \"RiskAssessment\", \"RiskEvidenceSynthesis\", \"Schedule\", \"SearchParameter\", \"Sequence\", + \"ServiceDefinition\", \"ServiceRequest\", \"Slot\", \"Specimen\", \"SpecimenDefinition\", + \"StructureDefinition\", \"StructureMap\", \"Subscription\", \"Substance\", + \"SubstanceNucleicAcid\", \"SubstancePolymer\", \"SubstanceProtein\", + \"SubstanceReferenceInformation\", \"SubstanceSourceMaterial\", \"SubstanceSpecification\", + \"SupplyDelivery\", \"SupplyRequest\", \"Task\", \"TerminologyCapabilities\", \"TestReport\", + \"TestScript\", \"ValueSet\", \"VerificationResult\", and \"VisionPrescription\".""" + resource_fhir_account: Optional[str] = rest_field(name="resourceFhirAccount") + """Domain name of FHIR account for this resource.""" + resource_fhir_id: Optional[str] = rest_field(name="resourceFhirId") + """Id of HL7 FHIR resource.""" + resource_version_id: Optional[int] = rest_field(name="resourceVersionId") + """VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or + deleted(soft-deletion).""" + + @overload + def __init__( + self, + *, + resource_type: Union[str, "_models.HealthcareFhirResourceType"], + resource_fhir_account: Optional[str] = None, + resource_fhir_id: Optional[str] = None, + resource_version_id: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IotHubDeviceConnectedEventData(DeviceConnectionStateEventProperties): + """Event data for Microsoft.Devices.DeviceConnected event. + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar module_id: The unique identifier of the module. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype module_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar device_connection_state_event_info: Information about the device connection state event. + Required. + :vartype device_connection_state_event_info: + ~azure.eventgrid.models.DeviceConnectionStateEventInfo + """ + + @overload + def __init__( + self, + *, + device_connection_state_event_info: "_models.DeviceConnectionStateEventInfo", + device_id: Optional[str] = None, + module_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IotHubDeviceCreatedEventData(DeviceLifeCycleEventProperties): + """Event data for Microsoft.Devices.DeviceCreated event. + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar twin: Information about the device twin, which is the cloud representation of application + device metadata. Required. + :vartype twin: ~azure.eventgrid.models.DeviceTwinInfo + """ + + @overload + def __init__( + self, + *, + twin: "_models.DeviceTwinInfo", + device_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IotHubDeviceDeletedEventData(DeviceLifeCycleEventProperties): + """Event data for Microsoft.Devices.DeviceDeleted event. + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar twin: Information about the device twin, which is the cloud representation of application + device metadata. Required. + :vartype twin: ~azure.eventgrid.models.DeviceTwinInfo + """ + + @overload + def __init__( + self, + *, + twin: "_models.DeviceTwinInfo", + device_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IotHubDeviceDisconnectedEventData(DeviceConnectionStateEventProperties): + """Event data for Microsoft.Devices.DeviceDisconnected event. + + + :ivar device_id: The unique identifier of the device. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype device_id: str + :ivar module_id: The unique identifier of the module. This case-sensitive string can be up to + 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following + special characters: - : . + % _ # * ? ! ( ) , = ``@`` ; $ '. + :vartype module_id: str + :ivar hub_name: Name of the IoT Hub where the device was created or deleted. + :vartype hub_name: str + :ivar device_connection_state_event_info: Information about the device connection state event. + Required. + :vartype device_connection_state_event_info: + ~azure.eventgrid.models.DeviceConnectionStateEventInfo + """ + + @overload + def __init__( + self, + *, + device_connection_state_event_info: "_models.DeviceConnectionStateEventInfo", + device_id: Optional[str] = None, + module_id: Optional[str] = None, + hub_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IotHubDeviceTelemetryEventData(DeviceTelemetryEventProperties): + """Event data for Microsoft.Devices.DeviceTelemetry event. + + + :ivar body: The content of the message from the device. Required. + :vartype body: dict[str, any] + :ivar properties: Application properties are user-defined strings that can be added to the + message. These fields are optional. Required. + :vartype properties: dict[str, str] + :ivar system_properties: System properties help identify contents and source of the messages. + Required. + :vartype system_properties: dict[str, str] + """ + + @overload + def __init__( + self, + *, + body: Dict[str, Any], + properties: Dict[str, str], + system_properties: Dict[str, str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultAccessPolicyChangedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.KeyVault.VaultAccessPolicyChanged event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultCertificateExpiredEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.CertificateExpired + event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultCertificateNearExpiryEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.CertificateNearExpiry + event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultCertificateNewVersionCreatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.KeyVault.CertificateNewVersionCreated event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultKeyExpiredEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyExpired event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultKeyNearExpiryEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyNearExpiry event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultKeyNewVersionCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.KeyNewVersionCreated + event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultSecretExpiredEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.SecretExpired event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultSecretNearExpiryEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.SecretNearExpiry + event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultSecretNewVersionCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.KeyVault.SecretNewVersionCreated event. + + :ivar id: The id of the object that triggered this event. + :vartype id: str + :ivar vault_name: Key vault name of the object that triggered this event. + :vartype vault_name: str + :ivar object_type: The type of the object that triggered this event. + :vartype object_type: str + :ivar object_name: The name of the object that triggered this event. + :vartype object_name: str + :ivar version: The version of the object that triggered this event. + :vartype version: str + :ivar nbf: Not before date of the object that triggered this event. + :vartype nbf: float + :ivar exp: The expiration date of the object that triggered this event. + :vartype exp: float + """ + + id: Optional[str] = rest_field(name="Id") + """The id of the object that triggered this event.""" + vault_name: Optional[str] = rest_field(name="VaultName") + """Key vault name of the object that triggered this event.""" + object_type: Optional[str] = rest_field(name="ObjectType") + """The type of the object that triggered this event.""" + object_name: Optional[str] = rest_field(name="ObjectName") + """The name of the object that triggered this event.""" + version: Optional[str] = rest_field(name="Version") + """The version of the object that triggered this event.""" + nbf: Optional[float] = rest_field(name="NBF") + """Not before date of the object that triggered this event.""" + exp: Optional[float] = rest_field(name="EXP") + """The expiration date of the object that triggered this event.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + vault_name: Optional[str] = None, + object_type: Optional[str] = None, + object_name: Optional[str] = None, + version: Optional[str] = None, + nbf: Optional[float] = None, + exp: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MachineLearningServicesDatasetDriftDetectedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.MachineLearningServices.DatasetDriftDetected event. + + + :ivar data_drift_id: The ID of the data drift monitor that triggered the event. + :vartype data_drift_id: str + :ivar data_drift_name: The name of the data drift monitor that triggered the event. + :vartype data_drift_name: str + :ivar run_id: The ID of the Run that detected data drift. + :vartype run_id: str + :ivar base_dataset_id: The ID of the base Dataset used to detect drift. + :vartype base_dataset_id: str + :ivar target_dataset_id: The ID of the target Dataset used to detect drift. + :vartype target_dataset_id: str + :ivar drift_coefficient: The coefficient result that triggered the event. + :vartype drift_coefficient: float + :ivar start_time: The start time of the target dataset time series that resulted in drift + detection. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the target dataset time series that resulted in drift + detection. Required. + :vartype end_time: ~datetime.datetime + """ + + data_drift_id: Optional[str] = rest_field(name="dataDriftId") + """The ID of the data drift monitor that triggered the event.""" + data_drift_name: Optional[str] = rest_field(name="dataDriftName") + """The name of the data drift monitor that triggered the event.""" + run_id: Optional[str] = rest_field(name="runId") + """The ID of the Run that detected data drift.""" + base_dataset_id: Optional[str] = rest_field(name="baseDatasetId") + """The ID of the base Dataset used to detect drift.""" + target_dataset_id: Optional[str] = rest_field(name="targetDatasetId") + """The ID of the target Dataset used to detect drift.""" + drift_coefficient: Optional[float] = rest_field(name="driftCoefficient") + """The coefficient result that triggered the event.""" + start_time: datetime.datetime = rest_field(name="startTime", format="rfc3339") + """The start time of the target dataset time series that resulted in drift detection. Required.""" + end_time: datetime.datetime = rest_field(name="endTime", format="rfc3339") + """The end time of the target dataset time series that resulted in drift detection. Required.""" + + @overload + def __init__( + self, + *, + start_time: datetime.datetime, + end_time: datetime.datetime, + data_drift_id: Optional[str] = None, + data_drift_name: Optional[str] = None, + run_id: Optional[str] = None, + base_dataset_id: Optional[str] = None, + target_dataset_id: Optional[str] = None, + drift_coefficient: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MachineLearningServicesModelDeployedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.MachineLearningServices.ModelDeployed event. + + + :ivar service_name: The name of the deployed service. + :vartype service_name: str + :ivar service_compute_type: The compute type (e.g. ACI, AKS) of the deployed service. + :vartype service_compute_type: str + :ivar model_ids: A common separated list of model IDs. The IDs of the models deployed in the + service. + :vartype model_ids: str + :ivar service_tags: The tags of the deployed service. Required. + :vartype service_tags: dict[str, any] + :ivar service_properties: The properties of the deployed service. Required. + :vartype service_properties: dict[str, any] + """ + + service_name: Optional[str] = rest_field(name="serviceName") + """The name of the deployed service.""" + service_compute_type: Optional[str] = rest_field(name="serviceComputeType") + """The compute type (e.g. ACI, AKS) of the deployed service.""" + model_ids: Optional[str] = rest_field(name="modelIds") + """A common separated list of model IDs. The IDs of the models deployed in the service.""" + service_tags: Dict[str, Any] = rest_field(name="serviceTags") + """The tags of the deployed service. Required.""" + service_properties: Dict[str, Any] = rest_field(name="serviceProperties") + """The properties of the deployed service. Required.""" + + @overload + def __init__( + self, + *, + service_tags: Dict[str, Any], + service_properties: Dict[str, Any], + service_name: Optional[str] = None, + service_compute_type: Optional[str] = None, + model_ids: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MachineLearningServicesModelRegisteredEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.MachineLearningServices.ModelRegistered event. + + + :ivar model_name: The name of the model that was registered. + :vartype model_name: str + :ivar model_version: The version of the model that was registered. + :vartype model_version: str + :ivar model_tags: The tags of the model that was registered. Required. + :vartype model_tags: dict[str, any] + :ivar model_properties: The properties of the model that was registered. Required. + :vartype model_properties: dict[str, any] + """ + + model_name: Optional[str] = rest_field(name="modelName") + """The name of the model that was registered.""" + model_version: Optional[str] = rest_field(name="modelVersion") + """The version of the model that was registered.""" + model_tags: Dict[str, Any] = rest_field(name="modelTags") + """The tags of the model that was registered. Required.""" + model_properties: Dict[str, Any] = rest_field(name="modelProperties") + """The properties of the model that was registered. Required.""" + + @overload + def __init__( + self, + *, + model_tags: Dict[str, Any], + model_properties: Dict[str, Any], + model_name: Optional[str] = None, + model_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MachineLearningServicesRunCompletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.MachineLearningServices.RunCompleted event. + + + :ivar experiment_id: The ID of the experiment that the run belongs to. + :vartype experiment_id: str + :ivar experiment_name: The name of the experiment that the run belongs to. + :vartype experiment_name: str + :ivar run_id: The ID of the Run that was completed. + :vartype run_id: str + :ivar run_type: The Run Type of the completed Run. + :vartype run_type: str + :ivar run_tags: The tags of the completed Run. Required. + :vartype run_tags: dict[str, any] + :ivar run_properties: The properties of the completed Run. Required. + :vartype run_properties: dict[str, any] + """ + + experiment_id: Optional[str] = rest_field(name="experimentId") + """The ID of the experiment that the run belongs to.""" + experiment_name: Optional[str] = rest_field(name="experimentName") + """The name of the experiment that the run belongs to.""" + run_id: Optional[str] = rest_field(name="runId") + """The ID of the Run that was completed.""" + run_type: Optional[str] = rest_field(name="runType") + """The Run Type of the completed Run.""" + run_tags: Dict[str, Any] = rest_field(name="runTags") + """The tags of the completed Run. Required.""" + run_properties: Dict[str, Any] = rest_field(name="runProperties") + """The properties of the completed Run. Required.""" + + @overload + def __init__( + self, + *, + run_tags: Dict[str, Any], + run_properties: Dict[str, Any], + experiment_id: Optional[str] = None, + experiment_name: Optional[str] = None, + run_id: Optional[str] = None, + run_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MachineLearningServicesRunStatusChangedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.MachineLearningServices.RunStatusChanged event. + + + :ivar experiment_id: The ID of the experiment that the Machine Learning Run belongs to. + :vartype experiment_id: str + :ivar experiment_name: The name of the experiment that the Machine Learning Run belongs to. + :vartype experiment_name: str + :ivar run_id: The ID of the Machine Learning Run. + :vartype run_id: str + :ivar run_type: The Run Type of the Machine Learning Run. + :vartype run_type: str + :ivar run_tags: The tags of the Machine Learning Run. Required. + :vartype run_tags: dict[str, any] + :ivar run_properties: The properties of the Machine Learning Run. Required. + :vartype run_properties: dict[str, any] + :ivar run_status: The status of the Machine Learning Run. + :vartype run_status: str + """ + + experiment_id: Optional[str] = rest_field(name="experimentId") + """The ID of the experiment that the Machine Learning Run belongs to.""" + experiment_name: Optional[str] = rest_field(name="experimentName") + """The name of the experiment that the Machine Learning Run belongs to.""" + run_id: Optional[str] = rest_field(name="runId") + """The ID of the Machine Learning Run.""" + run_type: Optional[str] = rest_field(name="runType") + """The Run Type of the Machine Learning Run.""" + run_tags: Dict[str, Any] = rest_field(name="runTags") + """The tags of the Machine Learning Run. Required.""" + run_properties: Dict[str, Any] = rest_field(name="runProperties") + """The properties of the Machine Learning Run. Required.""" + run_status: Optional[str] = rest_field(name="runStatus") + """The status of the Machine Learning Run.""" + + @overload + def __init__( + self, + *, + run_tags: Dict[str, Any], + run_properties: Dict[str, Any], + experiment_id: Optional[str] = None, + experiment_name: Optional[str] = None, + run_id: Optional[str] = None, + run_type: Optional[str] = None, + run_status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MapsGeofenceEventProperties(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, + GeofenceExited, GeofenceResult). + + + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar geometries: Lists the fence geometries that either fully contain the coordinate position + or have an overlap with the searchBuffer around the fence. Required. + :vartype geometries: list[~azure.eventgrid.models.MapsGeofenceGeometry] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. + :vartype is_event_published: bool + """ + + expired_geofence_geometry_id: Optional[List[str]] = rest_field(name="expiredGeofenceGeometryId") + """Lists of the geometry ID of the geofence which is expired relative to the user time in the + request.""" + geometries: List["_models.MapsGeofenceGeometry"] = rest_field() + """Lists the fence geometries that either fully contain the coordinate position or have an overlap + with the searchBuffer around the fence. Required.""" + invalid_period_geofence_geometry_id: Optional[List[str]] = rest_field(name="invalidPeriodGeofenceGeometryId") + """Lists of the geometry ID of the geofence which is in invalid period relative to the user time + in the request.""" + is_event_published: Optional[bool] = rest_field(name="isEventPublished") + """True if at least one event is published to the Azure Maps event subscriber, false if no event + is published to the Azure Maps event subscriber.""" + + @overload + def __init__( + self, + *, + geometries: List["_models.MapsGeofenceGeometry"], + expired_geofence_geometry_id: Optional[List[str]] = None, + invalid_period_geofence_geometry_id: Optional[List[str]] = None, + is_event_published: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MapsGeofenceEnteredEventData(MapsGeofenceEventProperties): + """Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceEntered event. + + + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar geometries: Lists the fence geometries that either fully contain the coordinate position + or have an overlap with the searchBuffer around the fence. Required. + :vartype geometries: list[~azure.eventgrid.models.MapsGeofenceGeometry] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. + :vartype is_event_published: bool + """ + + @overload + def __init__( + self, + *, + geometries: List["_models.MapsGeofenceGeometry"], + expired_geofence_geometry_id: Optional[List[str]] = None, + invalid_period_geofence_geometry_id: Optional[List[str]] = None, + is_event_published: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MapsGeofenceExitedEventData(MapsGeofenceEventProperties): + """Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. + + + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar geometries: Lists the fence geometries that either fully contain the coordinate position + or have an overlap with the searchBuffer around the fence. Required. + :vartype geometries: list[~azure.eventgrid.models.MapsGeofenceGeometry] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. + :vartype is_event_published: bool + """ + + @overload + def __init__( + self, + *, + geometries: List["_models.MapsGeofenceGeometry"], + expired_geofence_geometry_id: Optional[List[str]] = None, + invalid_period_geofence_geometry_id: Optional[List[str]] = None, + is_event_published: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MapsGeofenceGeometry(_model_base.Model): + """The geofence geometry. + + :ivar device_id: ID of the device. + :vartype device_id: str + :ivar distance: Distance from the coordinate to the closest border of the geofence. Positive + means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, + but more than the value of searchBuffer away from the closest geofence border, then the value + is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside + the polygon, but more than the value of searchBuffer away from the closest geofencing + border,then the value is -999. A value of 999 means that there is great confidence the + coordinate is well outside the geofence. A value of -999 means that there is great confidence + the coordinate is well within the geofence. + :vartype distance: float + :ivar geometry_id: The unique ID for the geofence geometry. + :vartype geometry_id: str + :ivar nearest_lat: Latitude of the nearest point of the geometry. + :vartype nearest_lat: float + :ivar nearest_lon: Longitude of the nearest point of the geometry. + :vartype nearest_lon: float + :ivar ud_id: The unique id returned from user upload service when uploading a geofence. Will + not be included in geofencing post API. + :vartype ud_id: str + """ + + device_id: Optional[str] = rest_field(name="deviceId") + """ID of the device.""" + distance: Optional[float] = rest_field() + """Distance from the coordinate to the closest border of the geofence. Positive means the + coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more + than the value of searchBuffer away from the closest geofence border, then the value is 999. + Negative means the coordinate is inside of the geofence. If the coordinate is inside the + polygon, but more than the value of searchBuffer away from the closest geofencing border,then + the value is -999. A value of 999 means that there is great confidence the coordinate is well + outside the geofence. A value of -999 means that there is great confidence the coordinate is + well within the geofence.""" + geometry_id: Optional[str] = rest_field(name="geometryId") + """The unique ID for the geofence geometry.""" + nearest_lat: Optional[float] = rest_field(name="nearestLat") + """Latitude of the nearest point of the geometry.""" + nearest_lon: Optional[float] = rest_field(name="nearestLon") + """Longitude of the nearest point of the geometry.""" + ud_id: Optional[str] = rest_field(name="udId") + """The unique id returned from user upload service when uploading a geofence. Will not be included + in geofencing post API.""" + + @overload + def __init__( + self, + *, + device_id: Optional[str] = None, + distance: Optional[float] = None, + geometry_id: Optional[str] = None, + nearest_lat: Optional[float] = None, + nearest_lon: Optional[float] = None, + ud_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MapsGeofenceResultEventData(MapsGeofenceEventProperties): + """Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceResult event. + + + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar geometries: Lists the fence geometries that either fully contain the coordinate position + or have an overlap with the searchBuffer around the fence. Required. + :vartype geometries: list[~azure.eventgrid.models.MapsGeofenceGeometry] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. + :vartype is_event_published: bool + """ + + @overload + def __init__( + self, + *, + geometries: List["_models.MapsGeofenceGeometry"], + expired_geofence_geometry_id: Optional[List[str]] = None, + invalid_period_geofence_geometry_id: Optional[List[str]] = None, + is_event_published: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MicrosoftTeamsAppIdentifierModel(_model_base.Model): + """A Microsoft Teams application. + + + :ivar app_id: The Id of the Microsoft Teams application. Required. + :vartype app_id: str + :ivar cloud: The cloud that the Microsoft Teams application belongs to. By default 'public' if + missing. Required. Known values are: "public", "dod", and "gcch". + :vartype cloud: str or ~azure.eventgrid.models.CommunicationCloudEnvironmentModel + """ + + app_id: str = rest_field(name="appId") + """The Id of the Microsoft Teams application. Required.""" + cloud: Union[str, "_models.CommunicationCloudEnvironmentModel"] = rest_field() + """The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. + Required. Known values are: \"public\", \"dod\", and \"gcch\".""" + + @overload + def __init__( + self, + *, + app_id: str, + cloud: Union[str, "_models.CommunicationCloudEnvironmentModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MicrosoftTeamsUserIdentifierModel(_model_base.Model): + """A Microsoft Teams user. + + + :ivar user_id: The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id + of the user. Required. + :vartype user_id: str + :ivar is_anonymous: True if the Microsoft Teams user is anonymous. By default false if missing. + :vartype is_anonymous: bool + :ivar cloud: The cloud that the Microsoft Teams user belongs to. By default 'public' if + missing. Required. Known values are: "public", "dod", and "gcch". + :vartype cloud: str or ~azure.eventgrid.models.CommunicationCloudEnvironmentModel + """ + + user_id: str = rest_field(name="userId") + """The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. + Required.""" + is_anonymous: Optional[bool] = rest_field(name="isAnonymous") + """True if the Microsoft Teams user is anonymous. By default false if missing.""" + cloud: Union[str, "_models.CommunicationCloudEnvironmentModel"] = rest_field() + """The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. Required. + Known values are: \"public\", \"dod\", and \"gcch\".""" + + @overload + def __init__( + self, + *, + user_id: str, + cloud: Union[str, "_models.CommunicationCloudEnvironmentModel"], + is_anonymous: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PhoneNumberIdentifierModel(_model_base.Model): + """A phone number. + + + :ivar value: The phone number in E.164 format. Required. + :vartype value: str + """ + + value: str = rest_field() + """The phone number in E.164 format. Required.""" + + @overload + def __init__( + self, + *, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyInsightsPolicyStateChangedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.PolicyInsights.PolicyStateChanged event. + + + :ivar timestamp: The time that the resource was scanned by Azure Policy in the Universal ISO + 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required. + :vartype timestamp: ~datetime.datetime + :ivar policy_assignment_id: The resource ID of the policy assignment. Required. + :vartype policy_assignment_id: str + :ivar policy_definition_id: The resource ID of the policy definition. Required. + :vartype policy_definition_id: str + :ivar policy_definition_reference_id: The reference ID for the policy definition inside the + initiative definition, if the policy assignment is for an initiative. May be empty. Required. + :vartype policy_definition_reference_id: str + :ivar compliance_state: The compliance state of the resource with respect to the policy + assignment. Required. + :vartype compliance_state: str + :ivar subscription_id: The subscription ID of the resource. Required. + :vartype subscription_id: str + :ivar compliance_reason_code: The compliance reason code. May be empty. Required. + :vartype compliance_reason_code: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime + format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required.""" + policy_assignment_id: str = rest_field(name="policyAssignmentId") + """The resource ID of the policy assignment. Required.""" + policy_definition_id: str = rest_field(name="policyDefinitionId") + """The resource ID of the policy definition. Required.""" + policy_definition_reference_id: str = rest_field(name="policyDefinitionReferenceId") + """The reference ID for the policy definition inside the initiative definition, if the policy + assignment is for an initiative. May be empty. Required.""" + compliance_state: str = rest_field(name="complianceState") + """The compliance state of the resource with respect to the policy assignment. Required.""" + subscription_id: str = rest_field(name="subscriptionId") + """The subscription ID of the resource. Required.""" + compliance_reason_code: str = rest_field(name="complianceReasonCode") + """The compliance reason code. May be empty. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + policy_assignment_id: str, + policy_definition_id: str, + policy_definition_reference_id: str, + compliance_state: str, + subscription_id: str, + compliance_reason_code: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyInsightsPolicyStateCreatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.PolicyInsights.PolicyStateCreated event. + + + :ivar timestamp: The time that the resource was scanned by Azure Policy in the Universal ISO + 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required. + :vartype timestamp: ~datetime.datetime + :ivar policy_assignment_id: The resource ID of the policy assignment. Required. + :vartype policy_assignment_id: str + :ivar policy_definition_id: The resource ID of the policy definition. Required. + :vartype policy_definition_id: str + :ivar policy_definition_reference_id: The reference ID for the policy definition inside the + initiative definition, if the policy assignment is for an initiative. May be empty. Required. + :vartype policy_definition_reference_id: str + :ivar compliance_state: The compliance state of the resource with respect to the policy + assignment. Required. + :vartype compliance_state: str + :ivar subscription_id: The subscription ID of the resource. Required. + :vartype subscription_id: str + :ivar compliance_reason_code: The compliance reason code. May be empty. Required. + :vartype compliance_reason_code: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime + format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required.""" + policy_assignment_id: str = rest_field(name="policyAssignmentId") + """The resource ID of the policy assignment. Required.""" + policy_definition_id: str = rest_field(name="policyDefinitionId") + """The resource ID of the policy definition. Required.""" + policy_definition_reference_id: str = rest_field(name="policyDefinitionReferenceId") + """The reference ID for the policy definition inside the initiative definition, if the policy + assignment is for an initiative. May be empty. Required.""" + compliance_state: str = rest_field(name="complianceState") + """The compliance state of the resource with respect to the policy assignment. Required.""" + subscription_id: str = rest_field(name="subscriptionId") + """The subscription ID of the resource. Required.""" + compliance_reason_code: str = rest_field(name="complianceReasonCode") + """The compliance reason code. May be empty. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + policy_assignment_id: str, + policy_definition_id: str, + policy_definition_reference_id: str, + compliance_state: str, + subscription_id: str, + compliance_reason_code: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyInsightsPolicyStateDeletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.PolicyInsights.PolicyStateDeleted event. + + + :ivar timestamp: The time that the resource was scanned by Azure Policy in the Universal ISO + 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required. + :vartype timestamp: ~datetime.datetime + :ivar policy_assignment_id: The resource ID of the policy assignment. Required. + :vartype policy_assignment_id: str + :ivar policy_definition_id: The resource ID of the policy definition. Required. + :vartype policy_definition_id: str + :ivar policy_definition_reference_id: The reference ID for the policy definition inside the + initiative definition, if the policy assignment is for an initiative. May be empty. Required. + :vartype policy_definition_reference_id: str + :ivar compliance_state: The compliance state of the resource with respect to the policy + assignment. Required. + :vartype compliance_state: str + :ivar subscription_id: The subscription ID of the resource. Required. + :vartype subscription_id: str + :ivar compliance_reason_code: The compliance reason code. May be empty. Required. + :vartype compliance_reason_code: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime + format yyyy-MM-ddTHH:mm:ss.fffffffZ. Required.""" + policy_assignment_id: str = rest_field(name="policyAssignmentId") + """The resource ID of the policy assignment. Required.""" + policy_definition_id: str = rest_field(name="policyDefinitionId") + """The resource ID of the policy definition. Required.""" + policy_definition_reference_id: str = rest_field(name="policyDefinitionReferenceId") + """The reference ID for the policy definition inside the initiative definition, if the policy + assignment is for an initiative. May be empty. Required.""" + compliance_state: str = rest_field(name="complianceState") + """The compliance state of the resource with respect to the policy assignment. Required.""" + subscription_id: str = rest_field(name="subscriptionId") + """The subscription ID of the resource. Required.""" + compliance_reason_code: str = rest_field(name="complianceReasonCode") + """The compliance reason code. May be empty. Required.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + policy_assignment_id: str, + policy_definition_id: str, + policy_definition_reference_id: str, + compliance_state: str, + subscription_id: str, + compliance_reason_code: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RedisExportRDBCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ExportRDBCompleted + event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar name: The name of this event. + :vartype name: str + :ivar status: The status of this event. Failed or succeeded. + :vartype status: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + name: Optional[str] = rest_field() + """The name of this event.""" + status: Optional[str] = rest_field() + """The status of this event. Failed or succeeded.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + name: Optional[str] = None, + status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RedisImportRDBCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ImportRDBCompleted + event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar name: The name of this event. + :vartype name: str + :ivar status: The status of this event. Failed or succeeded. + :vartype status: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + name: Optional[str] = rest_field() + """The name of this event.""" + status: Optional[str] = rest_field() + """The status of this event. Failed or succeeded.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + name: Optional[str] = None, + status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RedisPatchingCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Cache.PatchingCompleted event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar name: The name of this event. + :vartype name: str + :ivar status: The status of this event. Failed or succeeded. + :vartype status: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + name: Optional[str] = rest_field() + """The name of this event.""" + status: Optional[str] = rest_field() + """The status of this event. Failed or succeeded.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + name: Optional[str] = None, + status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RedisScalingCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Cache.ScalingCompleted event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar name: The name of this event. + :vartype name: str + :ivar status: The status of this event. Failed or succeeded. + :vartype status: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + name: Optional[str] = rest_field() + """The name of this event.""" + status: Optional[str] = rest_field() + """The status of this event. Failed or succeeded.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + name: Optional[str] = None, + status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceActionCancelEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceActionCancel + event. This is raised when a resource action operation is canceled. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceActionFailureEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Resources.ResourceActionFailure event. This is raised when a resource action + operation fails. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceActionSuccessEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Resources.ResourceActionSuccess event. This is raised when a resource action + operation succeeds. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceAuthorization(_model_base.Model): + """The details of the authorization for the resource. + + + :ivar scope: The scope of the authorization. + :vartype scope: str + :ivar action: The action being requested. + :vartype action: str + :ivar evidence: The evidence for the authorization. Required. + :vartype evidence: dict[str, str] + """ + + scope: Optional[str] = rest_field() + """The scope of the authorization.""" + action: Optional[str] = rest_field() + """The action being requested.""" + evidence: Dict[str, str] = rest_field() + """The evidence for the authorization. Required.""" + + @overload + def __init__( + self, + *, + evidence: Dict[str, str], + scope: Optional[str] = None, + action: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceDeleteCancelEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceDeleteCancel + event. This is raised when a resource delete operation is canceled. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceDeleteFailureEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Resources.ResourceDeleteFailure event. This is raised when a resource delete + operation fails. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceDeleteSuccessEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Resources.ResourceDeleteSuccess event. This is raised when a resource delete + operation succeeds. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceHttpRequest(_model_base.Model): + """The details of the HTTP request. + + :ivar client_request_id: The client request ID. + :vartype client_request_id: str + :ivar client_ip_address: The client IP address. + :vartype client_ip_address: str + :ivar method: The request method. + :vartype method: str + :ivar url: The url used in the request. + :vartype url: str + """ + + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request ID.""" + client_ip_address: Optional[str] = rest_field(name="clientIpAddress") + """The client IP address.""" + method: Optional[str] = rest_field() + """The request method.""" + url: Optional[str] = rest_field() + """The url used in the request.""" + + @overload + def __init__( + self, + *, + client_request_id: Optional[str] = None, + client_ip_address: Optional[str] = None, + method: Optional[str] = None, + url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceUpdatedEventData(_model_base.Model): # pylint: disable=name-too-long + """Describes the schema of the common properties across all ARN system topic events. + + + :ivar resource_info: resourceInfo details for update event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceUpdatedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + :ivar api_version: api version of the resource properties bag. + :vartype api_version: str + """ + + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails" = rest_field(name="resourceInfo") + """resourceInfo details for update event. Required.""" + operational_info: "_models.ResourceNotificationsOperationalDetails" = rest_field(name="operationalInfo") + """details about operational info. Required.""" + api_version: Optional[str] = rest_field(name="apiVersion") + """api version of the resource properties bag.""" + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsContainerServiceEventResourcesScheduledEventData( + ResourceNotificationsResourceUpdatedEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an event grid event for a + Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted preview + event. + + + :ivar resource_info: resourceInfo details for update event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceUpdatedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + :ivar api_version: api version of the resource properties bag. + :vartype api_version: str + """ + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsHealthResourcesAnnotatedEventData( + ResourceNotificationsResourceUpdatedEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated event. + + + :ivar resource_info: resourceInfo details for update event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceUpdatedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + :ivar api_version: api version of the resource properties bag. + :vartype api_version: str + """ + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData( + ResourceNotificationsResourceUpdatedEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged + event. + + + :ivar resource_info: resourceInfo details for update event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceUpdatedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + :ivar api_version: api version of the resource properties bag. + :vartype api_version: str + """ + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsOperationalDetails(_model_base.Model): + """details of operational info. + + + :ivar resource_event_time: Date and Time when resource was updated. Required. + :vartype resource_event_time: ~datetime.datetime + """ + + resource_event_time: datetime.datetime = rest_field(name="resourceEventTime", format="rfc3339") + """Date and Time when resource was updated. Required.""" + + @overload + def __init__( + self, + *, + resource_event_time: datetime.datetime, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceDeletedDetails(_model_base.Model): # pylint: disable=name-too-long + """Describes the schema of the properties under resource info which are common + across all ARN system topic delete events. + + :ivar id: id of the resource for which the event is being emitted. + :vartype id: str + :ivar name: name of the resource for which the event is being emitted. + :vartype name: str + :ivar type: the type of the resource for which the event is being emitted. + :vartype type: str + """ + + id: Optional[str] = rest_field() + """id of the resource for which the event is being emitted.""" + name: Optional[str] = rest_field() + """name of the resource for which the event is being emitted.""" + type: Optional[str] = rest_field() + """the type of the resource for which the event is being emitted.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceDeletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Describes the schema of the common properties across all ARN system topic + delete events. + + + :ivar resource_info: resourceInfo details for delete event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceDeletedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + """ + + resource_info: "_models.ResourceNotificationsResourceDeletedDetails" = rest_field(name="resourceInfo") + """resourceInfo details for delete event. Required.""" + operational_info: "_models.ResourceNotificationsOperationalDetails" = rest_field(name="operationalInfo") + """details about operational info. Required.""" + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceDeletedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceManagementCreatedOrUpdatedEventData( + ResourceNotificationsResourceUpdatedEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ResourceNotifications.Resources.CreatedOrUpdated event. + + + :ivar resource_info: resourceInfo details for update event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceUpdatedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + :ivar api_version: api version of the resource properties bag. + :vartype api_version: str + """ + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceUpdatedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + api_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceManagementDeletedEventData( + ResourceNotificationsResourceDeletedEventData +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ResourceNotifications.Resources.Deleted event. + + + :ivar resource_info: resourceInfo details for delete event. Required. + :vartype resource_info: ~azure.eventgrid.models.ResourceNotificationsResourceDeletedDetails + :ivar operational_info: details about operational info. Required. + :vartype operational_info: ~azure.eventgrid.models.ResourceNotificationsOperationalDetails + """ + + @overload + def __init__( + self, + *, + resource_info: "_models.ResourceNotificationsResourceDeletedDetails", + operational_info: "_models.ResourceNotificationsOperationalDetails", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceNotificationsResourceUpdatedDetails(_model_base.Model): # pylint: disable=name-too-long + """Describes the schema of the properties under resource info which are common + across all ARN system topic events. + + + :ivar id: id of the resource for which the event is being emitted. + :vartype id: str + :ivar name: name of the resource for which the event is being emitted. + :vartype name: str + :ivar type: the type of the resource for which the event is being emitted. + :vartype type: str + :ivar location: the location of the resource for which the event is being emitted. + :vartype location: str + :ivar tags: the tags on the resource for which the event is being emitted. Required. + :vartype tags: dict[str, str] + :ivar properties: properties in the payload of the resource for which the event is being + emitted. Required. + :vartype properties: dict[str, any] + """ + + id: Optional[str] = rest_field() + """id of the resource for which the event is being emitted.""" + name: Optional[str] = rest_field() + """name of the resource for which the event is being emitted.""" + type: Optional[str] = rest_field() + """the type of the resource for which the event is being emitted.""" + location: Optional[str] = rest_field() + """the location of the resource for which the event is being emitted.""" + tags: Dict[str, str] = rest_field() + """the tags on the resource for which the event is being emitted. Required.""" + properties: Dict[str, Any] = rest_field() + """properties in the payload of the resource for which the event is being emitted. Required.""" + + @overload + def __init__( + self, + *, + tags: Dict[str, str], + properties: Dict[str, Any], + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceWriteCancelEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteCancel + event. This is raised when a resource create or update operation is canceled. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceWriteFailureEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteFailure + event. This is raised when a resource create or update operation fails. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceWriteSuccessEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteSuccess + event. This is raised when a resource create or update operation succeeds. + + + :ivar tenant_id: The tenant ID of the resource. + :vartype tenant_id: str + :ivar subscription_id: The subscription ID of the resource. + :vartype subscription_id: str + :ivar resource_group: The resource group of the resource. + :vartype resource_group: str + :ivar resource_provider: The resource provider performing the operation. + :vartype resource_provider: str + :ivar resource_uri: The URI of the resource in the operation. + :vartype resource_uri: str + :ivar operation_name: The operation that was performed. + :vartype operation_name: str + :ivar status: The status of the operation. + :vartype status: str + :ivar authorization: The requested authorization for the operation. Required. + :vartype authorization: ~azure.eventgrid.models.ResourceAuthorization + :ivar claims: The properties of the claims. Required. + :vartype claims: dict[str, str] + :ivar correlation_id: An operation ID used for troubleshooting. + :vartype correlation_id: str + :ivar http_request: The details of the operation. Required. + :vartype http_request: ~azure.eventgrid.models.ResourceHttpRequest + """ + + tenant_id: Optional[str] = rest_field(name="tenantId") + """The tenant ID of the resource.""" + subscription_id: Optional[str] = rest_field(name="subscriptionId") + """The subscription ID of the resource.""" + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The resource group of the resource.""" + resource_provider: Optional[str] = rest_field(name="resourceProvider") + """The resource provider performing the operation.""" + resource_uri: Optional[str] = rest_field(name="resourceUri") + """The URI of the resource in the operation.""" + operation_name: Optional[str] = rest_field(name="operationName") + """The operation that was performed.""" + status: Optional[str] = rest_field() + """The status of the operation.""" + authorization: "_models.ResourceAuthorization" = rest_field() + """The requested authorization for the operation. Required.""" + claims: Dict[str, str] = rest_field() + """The properties of the claims. Required.""" + correlation_id: Optional[str] = rest_field(name="correlationId") + """An operation ID used for troubleshooting.""" + http_request: "_models.ResourceHttpRequest" = rest_field(name="httpRequest") + """The details of the operation. Required.""" + + @overload + def __init__( + self, + *, + authorization: "_models.ResourceAuthorization", + claims: Dict[str, str], + http_request: "_models.ResourceHttpRequest", + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + resource_provider: Optional[str] = None, + resource_uri: Optional[str] = None, + operation_name: Optional[str] = None, + status: Optional[str] = None, + correlation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData( + _model_base.Model +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ServiceBus.ActiveMessagesAvailablePeriodicNotifications event. + + :ivar namespace_name: The namespace name of the Microsoft.ServiceBus resource. + :vartype namespace_name: str + :ivar request_uri: The endpoint of the Microsoft.ServiceBus resource. + :vartype request_uri: str + :ivar entity_type: The entity type of the Microsoft.ServiceBus resource. Could be one of + 'queue' or 'subscriber'. + :vartype entity_type: str + :ivar queue_name: The name of the Microsoft.ServiceBus queue. If the entity type is of type + 'subscriber', then this value will be null. + :vartype queue_name: str + :ivar topic_name: The name of the Microsoft.ServiceBus topic. If the entity type is of type + 'queue', then this value will be null. + :vartype topic_name: str + :ivar subscription_name: The name of the Microsoft.ServiceBus topic's subscription. If the + entity type is of type 'queue', then this value will be null. + :vartype subscription_name: str + """ + + namespace_name: Optional[str] = rest_field(name="namespaceName") + """The namespace name of the Microsoft.ServiceBus resource.""" + request_uri: Optional[str] = rest_field(name="requestUri") + """The endpoint of the Microsoft.ServiceBus resource.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'.""" + queue_name: Optional[str] = rest_field(name="queueName") + """The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then + this value will be null.""" + topic_name: Optional[str] = rest_field(name="topicName") + """The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this + value will be null.""" + subscription_name: Optional[str] = rest_field(name="subscriptionName") + """The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type + 'queue', then this value will be null.""" + + @overload + def __init__( + self, + *, + namespace_name: Optional[str] = None, + request_uri: Optional[str] = None, + entity_type: Optional[str] = None, + queue_name: Optional[str] = None, + topic_name: Optional[str] = None, + subscription_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceBusActiveMessagesAvailableWithNoListenersEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners event. + + :ivar namespace_name: The namespace name of the Microsoft.ServiceBus resource. + :vartype namespace_name: str + :ivar request_uri: The endpoint of the Microsoft.ServiceBus resource. + :vartype request_uri: str + :ivar entity_type: The entity type of the Microsoft.ServiceBus resource. Could be one of + 'queue' or 'subscriber'. + :vartype entity_type: str + :ivar queue_name: The name of the Microsoft.ServiceBus queue. If the entity type is of type + 'subscriber', then this value will be null. + :vartype queue_name: str + :ivar topic_name: The name of the Microsoft.ServiceBus topic. If the entity type is of type + 'queue', then this value will be null. + :vartype topic_name: str + :ivar subscription_name: The name of the Microsoft.ServiceBus topic's subscription. If the + entity type is of type 'queue', then this value will be null. + :vartype subscription_name: str + """ + + namespace_name: Optional[str] = rest_field(name="namespaceName") + """The namespace name of the Microsoft.ServiceBus resource.""" + request_uri: Optional[str] = rest_field(name="requestUri") + """The endpoint of the Microsoft.ServiceBus resource.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'.""" + queue_name: Optional[str] = rest_field(name="queueName") + """The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then + this value will be null.""" + topic_name: Optional[str] = rest_field(name="topicName") + """The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this + value will be null.""" + subscription_name: Optional[str] = rest_field(name="subscriptionName") + """The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type + 'queue', then this value will be null.""" + + @overload + def __init__( + self, + *, + namespace_name: Optional[str] = None, + request_uri: Optional[str] = None, + entity_type: Optional[str] = None, + queue_name: Optional[str] = None, + topic_name: Optional[str] = None, + subscription_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData( + _model_base.Model +): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ServiceBus.DeadletterMessagesAvailablePeriodicNotifications event. + + :ivar namespace_name: The namespace name of the Microsoft.ServiceBus resource. + :vartype namespace_name: str + :ivar request_uri: The endpoint of the Microsoft.ServiceBus resource. + :vartype request_uri: str + :ivar entity_type: The entity type of the Microsoft.ServiceBus resource. Could be one of + 'queue' or 'subscriber'. + :vartype entity_type: str + :ivar queue_name: The name of the Microsoft.ServiceBus queue. If the entity type is of type + 'subscriber', then this value will be null. + :vartype queue_name: str + :ivar topic_name: The name of the Microsoft.ServiceBus topic. If the entity type is of type + 'queue', then this value will be null. + :vartype topic_name: str + :ivar subscription_name: The name of the Microsoft.ServiceBus topic's subscription. If the + entity type is of type 'queue', then this value will be null. + :vartype subscription_name: str + """ + + namespace_name: Optional[str] = rest_field(name="namespaceName") + """The namespace name of the Microsoft.ServiceBus resource.""" + request_uri: Optional[str] = rest_field(name="requestUri") + """The endpoint of the Microsoft.ServiceBus resource.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'.""" + queue_name: Optional[str] = rest_field(name="queueName") + """The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then + this value will be null.""" + topic_name: Optional[str] = rest_field(name="topicName") + """The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this + value will be null.""" + subscription_name: Optional[str] = rest_field(name="subscriptionName") + """The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type + 'queue', then this value will be null.""" + + @overload + def __init__( + self, + *, + namespace_name: Optional[str] = None, + request_uri: Optional[str] = None, + entity_type: Optional[str] = None, + queue_name: Optional[str] = None, + topic_name: Optional[str] = None, + subscription_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceBusDeadletterMessagesAvailableWithNoListenersEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners event. + + :ivar namespace_name: The namespace name of the Microsoft.ServiceBus resource. + :vartype namespace_name: str + :ivar request_uri: The endpoint of the Microsoft.ServiceBus resource. + :vartype request_uri: str + :ivar entity_type: The entity type of the Microsoft.ServiceBus resource. Could be one of + 'queue' or 'subscriber'. + :vartype entity_type: str + :ivar queue_name: The name of the Microsoft.ServiceBus queue. If the entity type is of type + 'subscriber', then this value will be null. + :vartype queue_name: str + :ivar topic_name: The name of the Microsoft.ServiceBus topic. If the entity type is of type + 'queue', then this value will be null. + :vartype topic_name: str + :ivar subscription_name: The name of the Microsoft.ServiceBus topic's subscription. If the + entity type is of type 'queue', then this value will be null. + :vartype subscription_name: str + """ + + namespace_name: Optional[str] = rest_field(name="namespaceName") + """The namespace name of the Microsoft.ServiceBus resource.""" + request_uri: Optional[str] = rest_field(name="requestUri") + """The endpoint of the Microsoft.ServiceBus resource.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The entity type of the Microsoft.ServiceBus resource. Could be one of 'queue' or 'subscriber'.""" + queue_name: Optional[str] = rest_field(name="queueName") + """The name of the Microsoft.ServiceBus queue. If the entity type is of type 'subscriber', then + this value will be null.""" + topic_name: Optional[str] = rest_field(name="topicName") + """The name of the Microsoft.ServiceBus topic. If the entity type is of type 'queue', then this + value will be null.""" + subscription_name: Optional[str] = rest_field(name="subscriptionName") + """The name of the Microsoft.ServiceBus topic's subscription. If the entity type is of type + 'queue', then this value will be null.""" + + @overload + def __init__( + self, + *, + namespace_name: Optional[str] = None, + request_uri: Optional[str] = None, + entity_type: Optional[str] = None, + queue_name: Optional[str] = None, + topic_name: Optional[str] = None, + subscription_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SignalRServiceClientConnectionConnectedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.SignalRService.ClientConnectionConnected event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar hub_name: The hub of connected client connection. + :vartype hub_name: str + :ivar connection_id: The connection Id of connected client connection. + :vartype connection_id: str + :ivar user_id: The user Id of connected client connection. + :vartype user_id: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + hub_name: Optional[str] = rest_field(name="hubName") + """The hub of connected client connection.""" + connection_id: Optional[str] = rest_field(name="connectionId") + """The connection Id of connected client connection.""" + user_id: Optional[str] = rest_field(name="userId") + """The user Id of connected client connection.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + hub_name: Optional[str] = None, + connection_id: Optional[str] = None, + user_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SignalRServiceClientConnectionDisconnectedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for a + Microsoft.SignalRService.ClientConnectionDisconnected event. + + + :ivar timestamp: The time at which the event occurred. Required. + :vartype timestamp: ~datetime.datetime + :ivar hub_name: The hub of connected client connection. + :vartype hub_name: str + :ivar connection_id: The connection Id of connected client connection. + :vartype connection_id: str + :ivar user_id: The user Id of connected client connection. + :vartype user_id: str + :ivar error_message: The message of error that cause the client connection disconnected. + :vartype error_message: str + """ + + timestamp: datetime.datetime = rest_field(format="rfc3339") + """The time at which the event occurred. Required.""" + hub_name: Optional[str] = rest_field(name="hubName") + """The hub of connected client connection.""" + connection_id: Optional[str] = rest_field(name="connectionId") + """The connection Id of connected client connection.""" + user_id: Optional[str] = rest_field(name="userId") + """The user Id of connected client connection.""" + error_message: Optional[str] = rest_field(name="errorMessage") + """The message of error that cause the client connection disconnected.""" + + @overload + def __init__( + self, + *, + timestamp: datetime.datetime, + hub_name: Optional[str] = None, + connection_id: Optional[str] = None, + user_id: Optional[str] = None, + error_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageAsyncOperationInitiatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Storage.AsyncOperationInitiated event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar content_type: The content type of the blob. This is the same as what would be returned in + the Content-Type header from the blob. + :vartype content_type: str + :ivar content_length: The size of the blob in bytes. This is the same as what would be returned + in the Content-Length header from the blob. + :vartype content_length: int + :ivar blob_type: The type of blob. + :vartype blob_type: str + :ivar url: The path to the blob. + :vartype url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular blob name. Users can use standard string comparison to understand the relative + sequence of two events on the same blob name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + content_type: Optional[str] = rest_field(name="contentType") + """The content type of the blob. This is the same as what would be returned in the Content-Type + header from the blob.""" + content_length: Optional[int] = rest_field(name="contentLength") + """The size of the blob in bytes. This is the same as what would be returned in the Content-Length + header from the blob.""" + blob_type: Optional[str] = rest_field(name="blobType") + """The type of blob.""" + url: Optional[str] = rest_field() + """The path to the blob.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular blob + name. Users can use standard string comparison to understand the relative sequence of two + events on the same blob name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + content_type: Optional[str] = None, + content_length: Optional[int] = None, + blob_type: Optional[str] = None, + url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageBlobCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobCreated event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar e_tag: The etag of the blob at the time this event was triggered. + :vartype e_tag: str + :ivar content_type: The content type of the blob. This is the same as what would be returned in + the Content-Type header from the blob. + :vartype content_type: str + :ivar content_length: The size of the blob in bytes. This is the same as what would be returned + in the Content-Length header from the blob. + :vartype content_length: int + :ivar content_offset: The offset of the blob in bytes. + :vartype content_offset: int + :ivar blob_type: The type of blob. + :vartype blob_type: str + :ivar access_tier: The current tier of the blob. Required. Known values are: "Hot", "Cool", + "Cold", "Archive", and "Default". + :vartype access_tier: str or ~azure.eventgrid.models.StorageBlobAccessTier + :ivar url: The path to the blob. + :vartype url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular blob name. Users can use standard string comparison to understand the relative + sequence of two events on the same blob name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + e_tag: Optional[str] = rest_field(name="eTag") + """The etag of the blob at the time this event was triggered.""" + content_type: Optional[str] = rest_field(name="contentType") + """The content type of the blob. This is the same as what would be returned in the Content-Type + header from the blob.""" + content_length: Optional[int] = rest_field(name="contentLength") + """The size of the blob in bytes. This is the same as what would be returned in the Content-Length + header from the blob.""" + content_offset: Optional[int] = rest_field(name="contentOffset") + """The offset of the blob in bytes.""" + blob_type: Optional[str] = rest_field(name="blobType") + """The type of blob.""" + access_tier: Union[str, "_models.StorageBlobAccessTier"] = rest_field(name="accessTier") + """The current tier of the blob. Required. Known values are: \"Hot\", \"Cool\", \"Cold\", + \"Archive\", and \"Default\".""" + url: Optional[str] = rest_field() + """The path to the blob.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular blob + name. Users can use standard string comparison to understand the relative sequence of two + events on the same blob name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + access_tier: Union[str, "_models.StorageBlobAccessTier"], + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + e_tag: Optional[str] = None, + content_type: Optional[str] = None, + content_length: Optional[int] = None, + content_offset: Optional[int] = None, + blob_type: Optional[str] = None, + url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageBlobDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobDeleted event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar content_type: The content type of the blob. This is the same as what would be returned in + the Content-Type header from the blob. + :vartype content_type: str + :ivar blob_type: The type of blob. + :vartype blob_type: str + :ivar url: The path to the blob. + :vartype url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular blob name. Users can use standard string comparison to understand the relative + sequence of two events on the same blob name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + content_type: Optional[str] = rest_field(name="contentType") + """The content type of the blob. This is the same as what would be returned in the Content-Type + header from the blob.""" + blob_type: Optional[str] = rest_field(name="blobType") + """The type of blob.""" + url: Optional[str] = rest_field() + """The path to the blob.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular blob + name. Users can use standard string comparison to understand the relative sequence of two + events on the same blob name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + content_type: Optional[str] = None, + blob_type: Optional[str] = None, + url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageBlobInventoryPolicyCompletedEventData(_model_base.Model): # pylint: disable=name-too-long + """Schema of the Data property of an EventGridEvent for an + Microsoft.Storage.BlobInventoryPolicyCompleted event. + + + :ivar schedule_date_time: The time at which inventory policy was scheduled. Required. + :vartype schedule_date_time: ~datetime.datetime + :ivar account_name: The account name for which inventory policy is registered. + :vartype account_name: str + :ivar rule_name: The rule name for inventory policy. + :vartype rule_name: str + :ivar policy_run_status: The status of inventory run, it can be + Succeeded/PartiallySucceeded/Failed. + :vartype policy_run_status: str + :ivar policy_run_status_message: The status message for inventory run. + :vartype policy_run_status_message: str + :ivar policy_run_id: The policy run id for inventory run. + :vartype policy_run_id: str + :ivar manifest_blob_url: The blob URL for manifest file for inventory run. + :vartype manifest_blob_url: str + """ + + schedule_date_time: datetime.datetime = rest_field(name="scheduleDateTime", format="rfc3339") + """The time at which inventory policy was scheduled. Required.""" + account_name: Optional[str] = rest_field(name="accountName") + """The account name for which inventory policy is registered.""" + rule_name: Optional[str] = rest_field(name="ruleName") + """The rule name for inventory policy.""" + policy_run_status: Optional[str] = rest_field(name="policyRunStatus") + """The status of inventory run, it can be Succeeded/PartiallySucceeded/Failed.""" + policy_run_status_message: Optional[str] = rest_field(name="policyRunStatusMessage") + """The status message for inventory run.""" + policy_run_id: Optional[str] = rest_field(name="policyRunId") + """The policy run id for inventory run.""" + manifest_blob_url: Optional[str] = rest_field(name="manifestBlobUrl") + """The blob URL for manifest file for inventory run.""" + + @overload + def __init__( + self, + *, + schedule_date_time: datetime.datetime, + account_name: Optional[str] = None, + rule_name: Optional[str] = None, + policy_run_status: Optional[str] = None, + policy_run_status_message: Optional[str] = None, + policy_run_id: Optional[str] = None, + manifest_blob_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageBlobRenamedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobRenamed event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar source_url: The path to the blob that was renamed. + :vartype source_url: str + :ivar destination_url: The new path to the blob after the rename operation. + :vartype destination_url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular blob name. Users can use standard string comparison to understand the relative + sequence of two events on the same blob name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + source_url: Optional[str] = rest_field(name="sourceUrl") + """The path to the blob that was renamed.""" + destination_url: Optional[str] = rest_field(name="destinationUrl") + """The new path to the blob after the rename operation.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular blob + name. Users can use standard string comparison to understand the relative sequence of two + events on the same blob name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + source_url: Optional[str] = None, + destination_url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageBlobTierChangedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.BlobTierChanged event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar content_type: The content type of the blob. This is the same as what would be returned in + the Content-Type header from the blob. + :vartype content_type: str + :ivar content_length: The size of the blob in bytes. This is the same as what would be returned + in the Content-Length header from the blob. + :vartype content_length: int + :ivar blob_type: The type of blob. + :vartype blob_type: str + :ivar access_tier: The current tier of the blob. Required. Known values are: "Hot", "Cool", + "Cold", "Archive", and "Default". + :vartype access_tier: str or ~azure.eventgrid.models.StorageBlobAccessTier + :ivar previous_tier: The previous tier of the blob. Required. Known values are: "Hot", "Cool", + "Cold", "Archive", and "Default". + :vartype previous_tier: str or ~azure.eventgrid.models.StorageBlobAccessTier + :ivar url: The path to the blob. + :vartype url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular blob name. Users can use standard string comparison to understand the relative + sequence of two events on the same blob name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + content_type: Optional[str] = rest_field(name="contentType") + """The content type of the blob. This is the same as what would be returned in the Content-Type + header from the blob.""" + content_length: Optional[int] = rest_field(name="contentLength") + """The size of the blob in bytes. This is the same as what would be returned in the Content-Length + header from the blob.""" + blob_type: Optional[str] = rest_field(name="blobType") + """The type of blob.""" + access_tier: Union[str, "_models.StorageBlobAccessTier"] = rest_field(name="accessTier") + """The current tier of the blob. Required. Known values are: \"Hot\", \"Cool\", \"Cold\", + \"Archive\", and \"Default\".""" + previous_tier: Union[str, "_models.StorageBlobAccessTier"] = rest_field(name="previousTier") + """The previous tier of the blob. Required. Known values are: \"Hot\", \"Cool\", \"Cold\", + \"Archive\", and \"Default\".""" + url: Optional[str] = rest_field() + """The path to the blob.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular blob + name. Users can use standard string comparison to understand the relative sequence of two + events on the same blob name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + access_tier: Union[str, "_models.StorageBlobAccessTier"], + previous_tier: Union[str, "_models.StorageBlobAccessTier"], + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + content_type: Optional[str] = None, + content_length: Optional[int] = None, + blob_type: Optional[str] = None, + url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageDirectoryCreatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryCreated + event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar e_tag: The etag of the directory at the time this event was triggered. + :vartype e_tag: str + :ivar url: The path to the directory. + :vartype url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular directory name. Users can use standard string comparison to understand the relative + sequence of two events on the same directory name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + e_tag: Optional[str] = rest_field(name="eTag") + """The etag of the directory at the time this event was triggered.""" + url: Optional[str] = rest_field() + """The path to the directory.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular directory + name. Users can use standard string comparison to understand the relative sequence of two + events on the same directory name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + e_tag: Optional[str] = None, + url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageDirectoryDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryDeleted + event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar url: The path to the deleted directory. + :vartype url: str + :ivar recursive: Is this event for a recursive delete operation. + :vartype recursive: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular directory name. Users can use standard string comparison to understand the relative + sequence of two events on the same directory name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + url: Optional[str] = rest_field() + """The path to the deleted directory.""" + recursive: Optional[str] = rest_field() + """Is this event for a recursive delete operation.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular directory + name. Users can use standard string comparison to understand the relative sequence of two + events on the same directory name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + url: Optional[str] = None, + recursive: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageDirectoryRenamedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Storage.DirectoryRenamed + event. + + + :ivar api: The name of the API/operation that triggered this event. + :vartype api: str + :ivar client_request_id: A request id provided by the client of the storage API operation that + triggered this event. + :vartype client_request_id: str + :ivar request_id: The request id generated by the storage service for the storage API operation + that triggered this event. + :vartype request_id: str + :ivar source_url: The path to the directory that was renamed. + :vartype source_url: str + :ivar destination_url: The new path to the directory after the rename operation. + :vartype destination_url: str + :ivar sequencer: An opaque string value representing the logical sequence of events for any + particular directory name. Users can use standard string comparison to understand the relative + sequence of two events on the same directory name. + :vartype sequencer: str + :ivar identity: The identity of the requester that triggered this event. + :vartype identity: str + :ivar storage_diagnostics: For service use only. Diagnostic data occasionally included by the + Azure Storage service. This property should be ignored by event consumers. Required. + :vartype storage_diagnostics: dict[str, any] + """ + + api: Optional[str] = rest_field() + """The name of the API/operation that triggered this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """A request id provided by the client of the storage API operation that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the storage service for the storage API operation that triggered + this event.""" + source_url: Optional[str] = rest_field(name="sourceUrl") + """The path to the directory that was renamed.""" + destination_url: Optional[str] = rest_field(name="destinationUrl") + """The new path to the directory after the rename operation.""" + sequencer: Optional[str] = rest_field() + """An opaque string value representing the logical sequence of events for any particular directory + name. Users can use standard string comparison to understand the relative sequence of two + events on the same directory name.""" + identity: Optional[str] = rest_field() + """The identity of the requester that triggered this event.""" + storage_diagnostics: Dict[str, Any] = rest_field(name="storageDiagnostics") + """For service use only. Diagnostic data occasionally included by the Azure Storage service. This + property should be ignored by event consumers. Required.""" + + @overload + def __init__( + self, + *, + storage_diagnostics: Dict[str, Any], + api: Optional[str] = None, + client_request_id: Optional[str] = None, + request_id: Optional[str] = None, + source_url: Optional[str] = None, + destination_url: Optional[str] = None, + sequencer: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageLifecyclePolicyActionSummaryDetail(_model_base.Model): # pylint: disable=name-too-long + """Execution statistics of a specific policy action in a Blob Management cycle. + + :ivar total_objects_count: Total number of objects to be acted on by this action. + :vartype total_objects_count: int + :ivar success_count: Number of success operations of this action. + :vartype success_count: int + :ivar error_list: Error messages of this action if any. + :vartype error_list: str + """ + + total_objects_count: Optional[int] = rest_field(name="totalObjectsCount") + """Total number of objects to be acted on by this action.""" + success_count: Optional[int] = rest_field(name="successCount") + """Number of success operations of this action.""" + error_list: Optional[str] = rest_field(name="errorList") + """Error messages of this action if any.""" + + @overload + def __init__( + self, + *, + total_objects_count: Optional[int] = None, + success_count: Optional[int] = None, + error_list: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageLifecyclePolicyCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Storage.LifecyclePolicyCompleted event. + + + :ivar schedule_time: The time the policy task was scheduled. + :vartype schedule_time: str + :ivar policy_run_summary: Policy execution summary which shows the completion status of a LCM + run". Required. + :vartype policy_run_summary: ~azure.eventgrid.models.StorageLifecyclePolicyRunSummary + :ivar delete_summary: Execution statistics of a specific policy action in a Blob Management + cycle. Required. + :vartype delete_summary: ~azure.eventgrid.models.StorageLifecyclePolicyActionSummaryDetail + :ivar tier_to_cool_summary: Execution statistics of a specific policy action in a Blob + Management cycle. Required. + :vartype tier_to_cool_summary: + ~azure.eventgrid.models.StorageLifecyclePolicyActionSummaryDetail + :ivar tier_to_archive_summary: Execution statistics of a specific policy action in a Blob + Management cycle. Required. + :vartype tier_to_archive_summary: + ~azure.eventgrid.models.StorageLifecyclePolicyActionSummaryDetail + :ivar tier_to_cold_summary: Execution statistics of a specific policy action in a Blob + Management cycle. Required. + :vartype tier_to_cold_summary: + ~azure.eventgrid.models.StorageLifecyclePolicyActionSummaryDetail + """ + + schedule_time: Optional[str] = rest_field(name="scheduleTime") + """The time the policy task was scheduled.""" + policy_run_summary: "_models.StorageLifecyclePolicyRunSummary" = rest_field(name="policyRunSummary") + """Policy execution summary which shows the completion status of a LCM run\". Required.""" + delete_summary: "_models.StorageLifecyclePolicyActionSummaryDetail" = rest_field(name="deleteSummary") + """Execution statistics of a specific policy action in a Blob Management cycle. Required.""" + tier_to_cool_summary: "_models.StorageLifecyclePolicyActionSummaryDetail" = rest_field(name="tierToCoolSummary") + """Execution statistics of a specific policy action in a Blob Management cycle. Required.""" + tier_to_archive_summary: "_models.StorageLifecyclePolicyActionSummaryDetail" = rest_field( + name="tierToArchiveSummary" + ) + """Execution statistics of a specific policy action in a Blob Management cycle. Required.""" + tier_to_cold_summary: "_models.StorageLifecyclePolicyActionSummaryDetail" = rest_field(name="tierToColdSummary") + """Execution statistics of a specific policy action in a Blob Management cycle. Required.""" + + @overload + def __init__( + self, + *, + policy_run_summary: "_models.StorageLifecyclePolicyRunSummary", + delete_summary: "_models.StorageLifecyclePolicyActionSummaryDetail", + tier_to_cool_summary: "_models.StorageLifecyclePolicyActionSummaryDetail", + tier_to_archive_summary: "_models.StorageLifecyclePolicyActionSummaryDetail", + tier_to_cold_summary: "_models.StorageLifecyclePolicyActionSummaryDetail", + schedule_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageLifecyclePolicyRunSummary(_model_base.Model): + """Policy run status of an account in a Blob Management cycle. + + + :ivar completion_status: Policy status can be Completed/CompletedWithError/Incomplete. + Required. Known values are: "Completed", "CompletedWithError", and "Incomplete". + :vartype completion_status: str or ~azure.eventgrid.models.StorageLifecycleCompletionStatus + """ + + completion_status: Union[str, "_models.StorageLifecycleCompletionStatus"] = rest_field(name="completionStatus") + """Policy status can be Completed/CompletedWithError/Incomplete. Required. Known values are: + \"Completed\", \"CompletedWithError\", and \"Incomplete\".""" + + @overload + def __init__( + self, + *, + completion_status: Union[str, "_models.StorageLifecycleCompletionStatus"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageTaskAssignmentCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an + Microsoft.Storage.StorageTaskAssignmentCompleted event. + + + :ivar status: The status for a storage task. Required. Known values are: "Succeeded" and + "Failed". + :vartype status: str or ~azure.eventgrid.models.StorageTaskAssignmentCompletedStatus + :ivar completed_date_time: The time at which a storage task was completed. Required. + :vartype completed_date_time: ~datetime.datetime + :ivar task_execution_id: The execution id for a storage task. + :vartype task_execution_id: str + :ivar task_name: The task name for a storage task. + :vartype task_name: str + :ivar summary_report_blob_url: The summary report blob url for a storage task. Required. + :vartype summary_report_blob_url: str + """ + + status: Union[str, "_models.StorageTaskAssignmentCompletedStatus"] = rest_field() + """The status for a storage task. Required. Known values are: \"Succeeded\" and \"Failed\".""" + completed_date_time: datetime.datetime = rest_field(name="completedDateTime", format="rfc3339") + """The time at which a storage task was completed. Required.""" + task_execution_id: Optional[str] = rest_field(name="taskExecutionId") + """The execution id for a storage task.""" + task_name: Optional[str] = rest_field(name="taskName") + """The task name for a storage task.""" + summary_report_blob_url: str = rest_field(name="summaryReportBlobUrl") + """The summary report blob url for a storage task. Required.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.StorageTaskAssignmentCompletedStatus"], + completed_date_time: datetime.datetime, + summary_report_blob_url: str, + task_execution_id: Optional[str] = None, + task_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageTaskAssignmentQueuedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an + Microsoft.Storage.StorageTaskAssignmentQueued event. + + + :ivar queued_date_time: The time at which a storage task was queued. Required. + :vartype queued_date_time: ~datetime.datetime + :ivar task_execution_id: The execution id for a storage task. + :vartype task_execution_id: str + """ + + queued_date_time: datetime.datetime = rest_field(name="queuedDateTime", format="rfc3339") + """The time at which a storage task was queued. Required.""" + task_execution_id: Optional[str] = rest_field(name="taskExecutionId") + """The execution id for a storage task.""" + + @overload + def __init__( + self, + *, + queued_date_time: datetime.datetime, + task_execution_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageTaskCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskCompleted + event. + + + :ivar status: The status for a storage task. Required. Known values are: "Succeeded" and + "Failed". + :vartype status: str or ~azure.eventgrid.models.StorageTaskCompletedStatus + :ivar completed_date_time: The time at which a storage task was completed. Required. + :vartype completed_date_time: ~datetime.datetime + :ivar task_execution_id: The execution id for a storage task. + :vartype task_execution_id: str + :ivar task_name: The task name for a storage task. + :vartype task_name: str + :ivar summary_report_blob_url: The summary report blob url for a storage task. Required. + :vartype summary_report_blob_url: str + """ + + status: Union[str, "_models.StorageTaskCompletedStatus"] = rest_field() + """The status for a storage task. Required. Known values are: \"Succeeded\" and \"Failed\".""" + completed_date_time: datetime.datetime = rest_field(name="completedDateTime", format="rfc3339") + """The time at which a storage task was completed. Required.""" + task_execution_id: Optional[str] = rest_field(name="taskExecutionId") + """The execution id for a storage task.""" + task_name: Optional[str] = rest_field(name="taskName") + """The task name for a storage task.""" + summary_report_blob_url: str = rest_field(name="summaryReportBlobUrl") + """The summary report blob url for a storage task. Required.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.StorageTaskCompletedStatus"], + completed_date_time: datetime.datetime, + summary_report_blob_url: str, + task_execution_id: Optional[str] = None, + task_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageTaskQueuedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskQueued + event. + + + :ivar queued_date_time: The time at which a storage task was queued. Required. + :vartype queued_date_time: ~datetime.datetime + :ivar task_execution_id: The execution id for a storage task. + :vartype task_execution_id: str + """ + + queued_date_time: datetime.datetime = rest_field(name="queuedDateTime", format="rfc3339") + """The time at which a storage task was queued. Required.""" + task_execution_id: Optional[str] = rest_field(name="taskExecutionId") + """The execution id for a storage task.""" + + @overload + def __init__( + self, + *, + queued_date_time: datetime.datetime, + task_execution_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubscriptionDeletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.EventGrid.SubscriptionDeletedEvent event. + + :ivar event_subscription_id: The Azure resource ID of the deleted event subscription. + :vartype event_subscription_id: str + """ + + event_subscription_id: Optional[str] = rest_field(name="eventSubscriptionId") + """The Azure resource ID of the deleted event subscription.""" + + @overload + def __init__( + self, + *, + event_subscription_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubscriptionValidationEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.EventGrid.SubscriptionValidationEvent event. + + :ivar validation_code: The validation code sent by Azure Event Grid to validate an event + subscription. + To complete the validation handshake, the subscriber must either respond with this validation + code as part of the validation response, + or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). + :vartype validation_code: str + :ivar validation_url: The validation URL sent by Azure Event Grid (available starting version + 2018-05-01-preview). + To complete the validation handshake, the subscriber must either respond with the + validationCode as part of the validation response, + or perform a GET request on the validationUrl (available starting version 2018-05-01-preview). + :vartype validation_url: str + """ + + validation_code: Optional[str] = rest_field(name="validationCode") + """The validation code sent by Azure Event Grid to validate an event subscription. + To complete the validation handshake, the subscriber must either respond with this validation + code as part of the validation response, + or perform a GET request on the validationUrl (available starting version 2018-05-01-preview).""" + validation_url: Optional[str] = rest_field(name="validationUrl") + """The validation URL sent by Azure Event Grid (available starting version 2018-05-01-preview). + To complete the validation handshake, the subscriber must either respond with the + validationCode as part of the validation response, + or perform a GET request on the validationUrl (available starting version 2018-05-01-preview).""" + + @overload + def __init__( + self, + *, + validation_code: Optional[str] = None, + validation_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SubscriptionValidationResponse(_model_base.Model): + """To complete an event subscription validation handshake, a subscriber can use + either the validationCode or the validationUrl received in a + SubscriptionValidationEvent. When the validationCode is used, the + SubscriptionValidationResponse can be used to build the response. + + :ivar validation_response: The validation response sent by the subscriber to Azure Event Grid + to complete the validation of an event subscription. + :vartype validation_response: str + """ + + validation_response: Optional[str] = rest_field(name="validationResponse") + """The validation response sent by the subscriber to Azure Event Grid to complete the validation + of an event subscription.""" + + @overload + def __init__( + self, + *, + validation_response: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebAppServicePlanUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.AppServicePlanUpdated + event. + + + :ivar app_service_plan_event_type_detail: Detail of action on the app service plan. Required. + :vartype app_service_plan_event_type_detail: + ~azure.eventgrid.models.AppServicePlanEventTypeDetail + :ivar sku: sku of app service plan. Required. + :vartype sku: ~azure.eventgrid.models.WebAppServicePlanUpdatedEventDataSku + :ivar name: name of the app service plan that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the app service + plan API operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + app service plan API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the app service plan API + operation that triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_service_plan_event_type_detail: "_models.AppServicePlanEventTypeDetail" = rest_field( + name="appServicePlanEventTypeDetail" + ) + """Detail of action on the app service plan. Required.""" + sku: "_models.WebAppServicePlanUpdatedEventDataSku" = rest_field() + """sku of app service plan. Required.""" + name: Optional[str] = rest_field() + """name of the app service plan that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the app service plan API operation that + triggered this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the app service plan API operation + that triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the app service plan API operation that + triggered this event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_service_plan_event_type_detail: "_models.AppServicePlanEventTypeDetail", + sku: "_models.WebAppServicePlanUpdatedEventDataSku", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebAppServicePlanUpdatedEventDataSku(_model_base.Model): + """sku of app service plan. + + :ivar name: name of app service plan sku. + :vartype name: str + :ivar tier: tier of app service plan sku. + :vartype tier: str + :ivar size: size of app service plan sku. + :vartype size: str + :ivar family: family of app service plan sku. + :vartype family: str + :ivar capacity: capacity of app service plan sku. + :vartype capacity: str + """ + + name: Optional[str] = rest_field() + """name of app service plan sku.""" + tier: Optional[str] = rest_field(name="Tier") + """tier of app service plan sku.""" + size: Optional[str] = rest_field(name="Size") + """size of app service plan sku.""" + family: Optional[str] = rest_field(name="Family") + """family of app service plan sku.""" + capacity: Optional[str] = rest_field(name="Capacity") + """capacity of app service plan sku.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebAppUpdatedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.AppUpdated event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebBackupOperationCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationCompleted + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebBackupOperationFailedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationFailed + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebBackupOperationStartedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.BackupOperationStarted + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebRestoreOperationCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationCompleted + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebRestoreOperationFailedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationFailed + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebRestoreOperationStartedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.RestoreOperationStarted + event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebSlotSwapCompletedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapCompleted event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebSlotSwapFailedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapFailed event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebSlotSwapStartedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapStarted event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str + """ + + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" + + @overload + def __init__( + self, + *, + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebSlotSwapWithPreviewCancelledEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a + Microsoft.Web.SlotSwapWithPreviewCancelled event. + + + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str """ - failed_lock_tokens: List["_models.FailedLockToken"] = rest_field(name="failedLockTokens") - """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.""" - succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") - """Array of lock tokens for the successfully released cloud events. Required.""" + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" @overload def __init__( self, *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): ... + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :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 + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RenewLocksResult(_model_base.Model): - """The result of the RenewLock operation. +class WebSlotSwapWithPreviewStartedEventData(_model_base.Model): + """Schema of the Data property of an EventGridEvent for a Microsoft.Web.SlotSwapWithPreviewStarted + event. - 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] + :ivar app_event_type_detail: Detail of action on the app. Required. + :vartype app_event_type_detail: ~azure.eventgrid.models.AppEventTypeDetail + :ivar name: name of the web site that had this event. + :vartype name: str + :ivar client_request_id: The client request id generated by the app service for the site API + operation that triggered this event. + :vartype client_request_id: str + :ivar correlation_request_id: The correlation request id generated by the app service for the + site API operation that triggered this event. + :vartype correlation_request_id: str + :ivar request_id: The request id generated by the app service for the site API operation that + triggered this event. + :vartype request_id: str + :ivar address: HTTP request URL of this operation. + :vartype address: str + :ivar verb: HTTP verb of this operation. + :vartype verb: str """ - failed_lock_tokens: List["_models.FailedLockToken"] = rest_field(name="failedLockTokens") - """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.""" - succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") - """Array of lock tokens for the successfully renewed locks. Required.""" + app_event_type_detail: "_models.AppEventTypeDetail" = rest_field(name="appEventTypeDetail") + """Detail of action on the app. Required.""" + name: Optional[str] = rest_field() + """name of the web site that had this event.""" + client_request_id: Optional[str] = rest_field(name="clientRequestId") + """The client request id generated by the app service for the site API operation that triggered + this event.""" + correlation_request_id: Optional[str] = rest_field(name="correlationRequestId") + """The correlation request id generated by the app service for the site API operation that + triggered this event.""" + request_id: Optional[str] = rest_field(name="requestId") + """The request id generated by the app service for the site API operation that triggered this + event.""" + address: Optional[str] = rest_field() + """HTTP request URL of this operation.""" + verb: Optional[str] = rest_field() + """HTTP verb of this operation.""" @overload def __init__( self, *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): ... + app_event_type_detail: "_models.AppEventTypeDetail", + name: Optional[str] = None, + client_request_id: Optional[str] = None, + correlation_request_id: Optional[str] = None, + request_id: Optional[str] = None, + address: Optional[str] = None, + verb: Optional[str] = None, + ) -> None: ... @overload - def __init__(self, mapping: Mapping[str, Any]): + def __init__(self, mapping: Mapping[str, Any]) -> None: """ :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 + def __init__(self, *args: Any, **kwargs: Any) -> None: 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 a552fe3c3125a..f7dd32510333d 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_patch.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_patch.py @@ -6,80 +6,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List, overload, Mapping, Any, Generic, TypeVar -from azure.core.messaging import CloudEvent -from ._models import ( - ReceiveDetails as InternalReceiveDetails, - BrokerProperties as InternalBrokerProperties, -) +from typing import List -DataType = TypeVar("DataType") - - -class ReceiveDetails(InternalReceiveDetails, Generic[DataType]): - """Receive operation details per Cloud Event. - - All required parameters must be populated in order to send to Azure. - - :ivar broker_properties: The Event Broker details. Required. - :vartype broker_properties: ~azure.eventgrid.models.BrokerProperties - :ivar event: Cloud Event details. Required. - :vartype event: ~azure.core.messaging.CloudEvent - """ - - @overload - def __init__( - self, - *, - broker_properties: "BrokerProperties", - event: CloudEvent[DataType], - ): ... - - @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) - - -class BrokerProperties(InternalBrokerProperties): - """Properties of the Event Broker operation. - - All required parameters must be populated in order to send to Azure. - - :ivar lock_token: The token used to lock the event. Required. - :vartype lock_token: str - :ivar delivery_count: The attempt count for deliverying the event. Required. - :vartype delivery_count: int - """ - - @overload - def __init__( - self, - *, - lock_token: str, - delivery_count: int, - ): ... - - @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) - - -__all__: List[str] = [ - "ReceiveDetails", - "BrokerProperties", -] # Add all objects you want publicly available to users at this package level +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/eventgrid/azure-eventgrid/setup.py b/sdk/eventgrid/azure-eventgrid/setup.py index b88a566aff72d..8e2a48f383c8c 100644 --- a/sdk/eventgrid/azure-eventgrid/setup.py +++ b/sdk/eventgrid/azure-eventgrid/setup.py @@ -13,7 +13,7 @@ PACKAGE_NAME = "azure-eventgrid" -PACKAGE_PPRINT_NAME = "Azure Event Grid" +PACKAGE_PPRINT_NAME = "Azure Event Grid System Events" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") @@ -38,7 +38,7 @@ url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", keywords="azure, azure sdk", classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", diff --git a/sdk/eventgrid/azure-eventgrid/tsp-location.yaml b/sdk/eventgrid/azure-eventgrid/tsp-location.yaml index 54fc7682d0145..5aa63910f4257 100644 --- a/sdk/eventgrid/azure-eventgrid/tsp-location.yaml +++ b/sdk/eventgrid/azure-eventgrid/tsp-location.yaml @@ -1,4 +1,4 @@ -cleanup: false -commit: 25afa22a250c0ad5a28671003f961b9cd20d60f6 -directory: specification/eventgrid/Azure.Messaging.EventGrid -repo: Azure/azure-rest-api-specs \ No newline at end of file +directory: specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents +commit: 68869aaa5472e4e1c74ff89421a6edad303af9aa +repo: Azure/azure-rest-api-specs +additionalDirectories: