From a6a0829376592d7b3dc48f1a9223e0442a299b64 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Wed, 18 Nov 2020 14:38:22 +0800 Subject: [PATCH] [T2]eventgrid wave3 (#14805) --- .../azure-mgmt-eventgrid/CHANGELOG.md | 55 + sdk/eventgrid/azure-mgmt-eventgrid/README.md | 9 +- .../azure/mgmt/eventgrid/__init__.py | 18 +- .../azure/mgmt/eventgrid/_configuration.py | 83 +- .../_event_grid_management_client.py | 143 +- .../eventgrid/{version.py => _version.py} | 9 +- .../azure/mgmt/eventgrid/aio/__init__.py | 10 + .../mgmt/eventgrid/aio/_configuration.py | 67 + .../aio/_event_grid_management_client.py | 99 + .../mgmt/eventgrid/aio/operations/__init__.py | 27 + .../operations/_domain_topics_operations.py | 425 +++ .../aio/operations/_domains_operations.py | 752 +++++ .../_event_subscriptions_operations.py | 1469 ++++++++++ .../eventgrid/aio/operations/_operations.py | 106 + ...private_endpoint_connections_operations.py | 470 ++++ .../_private_link_resources_operations.py | 211 ++ .../aio/operations/_topic_types_operations.py | 232 ++ .../aio/operations/_topics_operations.py | 836 ++++++ .../azure/mgmt/eventgrid/models/__init__.py | 305 +- .../_event_grid_management_client_enums.py | 389 +-- .../azure/mgmt/eventgrid/models/_models.py | 2249 ++++++--------- .../mgmt/eventgrid/models/_models_py3.py | 2453 +++++++---------- .../mgmt/eventgrid/models/_paged_models.py | 196 -- .../mgmt/eventgrid/operations/__init__.py | 27 +- .../operations/_domain_topics_operations.py | 518 ++-- .../operations/_domains_operations.py | 945 ++++--- .../operations/_event_channels_operations.py | 362 --- .../_event_subscriptions_operations.py | 1902 ++++++------- .../_extension_topics_operations.py | 106 - .../mgmt/eventgrid/operations/_operations.py | 124 +- .../_partner_namespaces_operations.py | 713 ----- .../_partner_registrations_operations.py | 545 ---- ...er_topic_event_subscriptions_operations.py | 585 ---- .../operations/_partner_topics_operations.py | 564 ---- ...private_endpoint_connections_operations.py | 599 ++-- .../_private_link_resources_operations.py | 243 +- ...em_topic_event_subscriptions_operations.py | 585 ---- .../operations/_system_topics_operations.py | 577 ---- .../operations/_topic_types_operations.py | 274 +- .../operations/_topics_operations.py | 1040 +++---- .../azure/mgmt/eventgrid/py.typed | 1 + sdk/eventgrid/azure-mgmt-eventgrid/setup.py | 4 +- .../recordings/test_domain.test_domain.yaml | 390 +++ .../azure-mgmt-eventgrid/tests/test_domain.py | 51 + 44 files changed, 10415 insertions(+), 10353 deletions(-) rename sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/{version.py => _version.py} (84%) create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/py.typed create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/tests/test_domain.py diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md index 039601754a92..e49d2ac32457 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md @@ -1,5 +1,60 @@ # Release History +## 8.0.0b1 (2020-10-31) + +This is beta preview version. +For detailed changelog please refer to equivalent stable version 3.0.0rc8(https://pypi.org/project/azure-mgmt-eventgrid/3.0.0rc8/) + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 3.0.0rc8 (2020-06-05) + +**Breaking changes** + + - Model EventSubscriptionUpdateParameters no longer has parameter dead_letter_with_resource_identity + - Model EventSubscriptionUpdateParameters no longer has parameter delivery_with_resource_identity + - Model DomainUpdateParameters no longer has parameter sku + - Model DomainUpdateParameters no longer has parameter identity + - Model Domain no longer has parameter sku + - Model Domain no longer has parameter identity + - Model EventSubscription no longer has parameter dead_letter_with_resource_identity + - Model EventSubscription no longer has parameter delivery_with_resource_identity + - Model TopicUpdateParameters no longer has parameter sku + - Model TopicUpdateParameters no longer has parameter identity + - Model Topic no longer has parameter sku + - Model Topic no longer has parameter identity + - Removed operation group ExtensionTopicsOperations + - Removed operation group PartnerNamespacesOperations + - Removed operation group PartnerRegistrationsOperations + - Removed operation group PartnerTopicsOperations + - Removed operation group SystemTopicEventSubscriptionsOperations + - Removed operation group SystemTopicsOperations + - Removed operation group PartnerTopicEventSubscriptionsOperations + - Removed operation group EventChannelsOperations + ## 3.0.0rc7 (2020-05-14) **Features** diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/README.md b/sdk/eventgrid/azure-mgmt-eventgrid/README.md index 6f020755a975..94dc5832d866 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/README.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/README.md @@ -7,9 +7,14 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( # Usage -For code examples, see [EventGrid Management](https://docs.microsoft.com/python/api/overview/azure/event-grid) -on docs.microsoft.com. +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [EventGrid Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) # Provide Feedback diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py index 23d74ebeeb64..6a0fbf411f3a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import EventGridManagementClientConfiguration from ._event_grid_management_client import EventGridManagementClient -__all__ = ['EventGridManagementClient', 'EventGridManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['EventGridManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py index b27d26eb4825..026ab4a91d42 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py @@ -1,50 +1,71 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class EventGridManagementClientConfiguration(Configuration): + """Configuration for EventGridManagementClient. -class EventGridManagementClientConfiguration(AzureConfiguration): - """Configuration for EventGridManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials that uniquely identify a - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(EventGridManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(EventGridManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-eventgrid/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2020-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-eventgrid/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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 ARMHttpLoggingPolicy(**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') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py index 829072a97703..b53ab516f500 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py @@ -1,126 +1,105 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential from ._configuration import EventGridManagementClientConfiguration from .operations import DomainsOperations from .operations import DomainTopicsOperations -from .operations import EventChannelsOperations from .operations import EventSubscriptionsOperations -from .operations import SystemTopicEventSubscriptionsOperations -from .operations import PartnerTopicEventSubscriptionsOperations from .operations import Operations -from .operations import PartnerNamespacesOperations -from .operations import PartnerRegistrationsOperations -from .operations import PartnerTopicsOperations +from .operations import TopicsOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations -from .operations import SystemTopicsOperations -from .operations import TopicsOperations -from .operations import ExtensionTopicsOperations from .operations import TopicTypesOperations from . import models -class EventGridManagementClient(SDKClient): - """Azure EventGrid Management Client - - :ivar config: Configuration for client. - :vartype config: EventGridManagementClientConfiguration +class EventGridManagementClient(object): + """Azure EventGrid Management Client. - :ivar domains: Domains operations + :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.eventgrid.operations.DomainsOperations - :ivar domain_topics: DomainTopics operations + :ivar domain_topics: DomainTopicsOperations operations :vartype domain_topics: azure.mgmt.eventgrid.operations.DomainTopicsOperations - :ivar event_channels: EventChannels operations - :vartype event_channels: azure.mgmt.eventgrid.operations.EventChannelsOperations - :ivar event_subscriptions: EventSubscriptions operations + :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.operations.EventSubscriptionsOperations - :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptions operations - :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations - :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptions operations - :vartype partner_topic_event_subscriptions: azure.mgmt.eventgrid.operations.PartnerTopicEventSubscriptionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.operations.Operations - :ivar partner_namespaces: PartnerNamespaces operations - :vartype partner_namespaces: azure.mgmt.eventgrid.operations.PartnerNamespacesOperations - :ivar partner_registrations: PartnerRegistrations operations - :vartype partner_registrations: azure.mgmt.eventgrid.operations.PartnerRegistrationsOperations - :ivar partner_topics: PartnerTopics operations - :vartype partner_topics: azure.mgmt.eventgrid.operations.PartnerTopicsOperations - :ivar private_endpoint_connections: PrivateEndpointConnections operations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.eventgrid.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResources operations + :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.eventgrid.operations.PrivateLinkResourcesOperations - :ivar system_topics: SystemTopics operations - :vartype system_topics: azure.mgmt.eventgrid.operations.SystemTopicsOperations - :ivar topics: Topics operations - :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations - :ivar extension_topics: ExtensionTopics operations - :vartype extension_topics: azure.mgmt.eventgrid.operations.ExtensionTopicsOperations - :ivar topic_types: TopicTypes operations + :ivar topic_types: TopicTypesOperations operations :vartype topic_types: azure.mgmt.eventgrid.operations.TopicTypesOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials that uniquely identify a - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = EventGridManagementClientConfiguration(credentials, subscription_id, base_url) - super(EventGridManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = EventGridManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-04-01-preview' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.domains = DomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.domain_topics = DomainTopicsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.event_channels = EventChannelsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.event_subscriptions = EventSubscriptionsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.partner_topic_event_subscriptions = PartnerTopicEventSubscriptionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) - self.partner_namespaces = PartnerNamespacesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.partner_registrations = PartnerRegistrationsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.partner_topics = PartnerTopicsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.system_topics = SystemTopicsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.extension_topics = ExtensionTopicsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.topic_types = TopicTypesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> EventGridManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/version.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py similarity index 84% rename from sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/version.py rename to sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py index 15b874a49702..0d5779dc14de 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/version.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py @@ -1,12 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0rc7" +VERSION = "8.0.0b1" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py new file mode 100644 index 000000000000..4f2ff94fca75 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._event_grid_management_client import EventGridManagementClient +__all__ = ['EventGridManagementClient'] diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py new file mode 100644 index 000000000000..f4c5094c778b --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EventGridManagementClientConfiguration(Configuration): + """Configuration for EventGridManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(EventGridManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-eventgrid/{}'.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 ARMHttpLoggingPolicy(**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') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py new file mode 100644 index 000000000000..47dbc6989afd --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py @@ -0,0 +1,99 @@ +# 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, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import EventGridManagementClientConfiguration +from .operations import DomainsOperations +from .operations import DomainTopicsOperations +from .operations import EventSubscriptionsOperations +from .operations import Operations +from .operations import TopicsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import TopicTypesOperations +from .. import models + + +class EventGridManagementClient(object): + """Azure EventGrid Management Client. + + :ivar domains: DomainsOperations operations + :vartype domains: azure.mgmt.eventgrid.aio.operations.DomainsOperations + :ivar domain_topics: DomainTopicsOperations operations + :vartype domain_topics: azure.mgmt.eventgrid.aio.operations.DomainTopicsOperations + :ivar event_subscriptions: EventSubscriptionsOperations operations + :vartype event_subscriptions: azure.mgmt.eventgrid.aio.operations.EventSubscriptionsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.eventgrid.aio.operations.Operations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.aio.operations.TopicsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.eventgrid.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.eventgrid.aio.operations.PrivateLinkResourcesOperations + :ivar topic_types: TopicTypesOperations operations + :vartype topic_types: azure.mgmt.eventgrid.aio.operations.TopicTypesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = EventGridManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.domains = DomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.domain_topics = DomainTopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_subscriptions = EventSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topic_types = TopicTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "EventGridManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py new file mode 100644 index 000000000000..d2719a3e3e6b --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._domains_operations import DomainsOperations +from ._domain_topics_operations import DomainTopicsOperations +from ._event_subscriptions_operations import EventSubscriptionsOperations +from ._operations import Operations +from ._topics_operations import TopicsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._topic_types_operations import TopicTypesOperations + +__all__ = [ + 'DomainsOperations', + 'DomainTopicsOperations', + 'EventSubscriptionsOperations', + 'Operations', + 'TopicsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'TopicTypesOperations', +] diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py new file mode 100644 index 000000000000..ee80b5e99137 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py @@ -0,0 +1,425 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainTopicsOperations: + """DomainTopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs + ) -> "models.DomainTopic": + """Get a domain topic. + + Get properties of a domain topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain_topic_name: Name of the topic. + :type domain_topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs + ) -> "models.DomainTopic": + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs + ) -> AsyncLROPoller["models.DomainTopic"]: + """Create or update a domain topic. + + Asynchronously creates or updates a new domain topic with the specified parameters. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain_topic_name: Name of the domain topic. + :type domain_topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DomainTopic or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.DomainTopic] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DomainTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a domain topic. + + Delete existing domain topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain_topic_name: Name of the domain topic. + :type domain_topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + def list_by_domain( + self, + resource_group_name: str, + domain_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DomainTopicsListResult"]: + """List domain topics. + + List all the topics in a domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Domain name. + :type domain_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainTopicsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.DomainTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DomainTopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py new file mode 100644 index 000000000000..ffd34d62b74a --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py @@ -0,0 +1,752 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainsOperations: + """DomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> "models.Domain": + """Get a domain. + + Get properties of a domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + domain_info: "models.Domain", + **kwargs + ) -> "models.Domain": + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_info, 'Domain') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + domain_info: "models.Domain", + **kwargs + ) -> AsyncLROPoller["models.Domain"]: + """Create or update a domain. + + Asynchronously creates or updates a new domain with the specified parameters. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain_info: Domain information. + :type domain_info: ~azure.mgmt.eventgrid.models.Domain + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_info=domain_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a domain. + + Delete existing domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + domain_name: str, + domain_update_parameters: "models.DomainUpdateParameters", + **kwargs + ) -> Optional["models.Domain"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Domain"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + domain_name: str, + domain_update_parameters: "models.DomainUpdateParameters", + **kwargs + ) -> AsyncLROPoller["models.Domain"]: + """Update a domain. + + Asynchronously updates a domain with the specified parameters. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param domain_update_parameters: Domain update information. + :type domain_update_parameters: ~azure.mgmt.eventgrid.models.DomainUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_update_parameters=domain_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DomainsListResult"]: + """List domains under an Azure subscription. + + List all the domains under an Azure subscription. + + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.DomainsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DomainsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DomainsListResult"]: + """List domains under a resource group. + + List all the domains under a resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.DomainsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DomainsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'} # type: ignore + + async def list_shared_access_keys( + self, + resource_group_name: str, + domain_name: str, + **kwargs + ) -> "models.DomainSharedAccessKeys": + """List keys for a domain. + + List the two keys used to publish to a domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.list_shared_access_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'} # type: ignore + + async def regenerate_key( + self, + resource_group_name: str, + domain_name: str, + key_name: str, + **kwargs + ) -> "models.DomainSharedAccessKeys": + """Regenerate key for a domain. + + Regenerate a shared access key for a domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the domain. + :type domain_name: str + :param key_name: Key name to regenerate key1 or key2. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _regenerate_key_request = models.DomainRegenerateKeyRequest(key_name=key_name) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_regenerate_key_request, 'DomainRegenerateKeyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DomainSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py new file mode 100644 index 000000000000..a738b6f8740b --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py @@ -0,0 +1,1469 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventSubscriptionsOperations: + """EventSubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + scope: str, + event_subscription_name: str, + **kwargs + ) -> "models.EventSubscription": + """Get an event subscription. + + Get properties of an event subscription. + + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. + :type scope: str + :param event_subscription_name: Name of the event subscription. + :type event_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _create_or_update_initial( + self, + scope: str, + event_subscription_name: str, + event_subscription_info: "models.EventSubscription", + **kwargs + ) -> "models.EventSubscription": + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(event_subscription_info, 'EventSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def begin_create_or_update( + self, + scope: str, + event_subscription_name: str, + event_subscription_info: "models.EventSubscription", + **kwargs + ) -> AsyncLROPoller["models.EventSubscription"]: + """Create or update an event subscription. + + Asynchronously creates a new event subscription or updates an existing event subscription based + on the specified scope. + + :param scope: The identifier of the resource to which the event subscription needs to be + created or updated. The scope can be a subscription, or a resource group, or a top level + resource belonging to a resource provider namespace, or an EventGrid topic. For example, use + '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. + :type scope: str + :param event_subscription_name: Name of the event subscription. Event subscription names must + be between 3 and 64 characters in length and should use alphanumeric letters only. + :type event_subscription_name: str + :param event_subscription_info: Event subscription properties containing the destination and + filter information. + :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + scope=scope, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _delete_initial( + self, + scope: str, + event_subscription_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def begin_delete( + self, + scope: str, + event_subscription_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete an event subscription. + + Delete an existing event subscription. + + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. + :type scope: str + :param event_subscription_name: Name of the event subscription. + :type event_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + scope=scope, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _update_initial( + self, + scope: str, + event_subscription_name: str, + event_subscription_update_parameters: "models.EventSubscriptionUpdateParameters", + **kwargs + ) -> "models.EventSubscription": + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def begin_update( + self, + scope: str, + event_subscription_name: str, + event_subscription_update_parameters: "models.EventSubscriptionUpdateParameters", + **kwargs + ) -> AsyncLROPoller["models.EventSubscription"]: + """Update an event subscription. + + Asynchronously updates an existing event subscription. + + :param scope: The scope of existing event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. + :type scope: str + :param event_subscription_name: Name of the event subscription to be updated. + :type event_subscription_name: str + :param event_subscription_update_parameters: Updated event subscription information. + :type event_subscription_update_parameters: ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + scope=scope, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def get_full_url( + self, + scope: str, + event_subscription_name: str, + **kwargs + ) -> "models.EventSubscriptionFullUrl": + """Get full URL of an event subscription. + + Get the full endpoint URL for an event subscription. + + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for a resource, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + for an EventGrid topic. + :type scope: str + :param event_subscription_name: Name of the event subscription. + :type event_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventSubscriptionFullUrl, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionFullUrl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get_full_url.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventSubscriptionFullUrl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_full_url.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + def list_global_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """Get an aggregated list of all global event subscriptions under an Azure subscription. + + List all aggregated global event subscriptions under a specific Azure subscription. + + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_global_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_global_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + + def list_global_by_subscription_for_topic_type( + self, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all global event subscriptions for a topic type. + + List all global event subscriptions under an Azure subscription for a topic type. + + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_global_by_subscription_for_topic_type.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_global_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + + def list_global_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all global event subscriptions under an Azure subscription and resource group. + + List all global event subscriptions under a specific Azure subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_global_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_global_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + + def list_global_by_resource_group_for_topic_type( + self, + resource_group_name: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all global event subscriptions under a resource group for a topic type. + + List all global event subscriptions under a resource group for a specific topic type. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_global_by_resource_group_for_topic_type.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_global_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + + def list_regional_by_subscription( + self, + location: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all regional event subscriptions under an Azure subscription. + + List all event subscriptions from the given location under a specific Azure subscription. + + :param location: Name of the location. + :type location: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_regional_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_regional_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + + def list_regional_by_resource_group( + self, + resource_group_name: str, + location: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all regional event subscriptions under an Azure subscription and resource group. + + List all event subscriptions from the given location under a specific Azure subscription and + resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param location: Name of the location. + :type location: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_regional_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_regional_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + + def list_regional_by_subscription_for_topic_type( + self, + location: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all regional event subscriptions under an Azure subscription for a topic type. + + List all event subscriptions from the given location under a specific Azure subscription and + topic type. + + :param location: Name of the location. + :type location: str + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_regional_by_subscription_for_topic_type.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_regional_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + + def list_regional_by_resource_group_for_topic_type( + self, + resource_group_name: str, + location: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all regional event subscriptions under an Azure subscription and resource group for a topic type. + + List all event subscriptions from the given location under a specific Azure subscription and + resource group and topic type. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param location: Name of the location. + :type location: str + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_regional_by_resource_group_for_topic_type.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_regional_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + + def list_by_resource( + self, + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all event subscriptions for a specific topic. + + List all event subscriptions that have been created for a specific topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param provider_namespace: Namespace of the provider of the topic. + :type provider_namespace: str + :param resource_type_name: Name of the resource type. + :type resource_type_name: str + :param resource_name: Name of the resource. + :type resource_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), + 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + + def list_by_domain_topic( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.EventSubscriptionsListResult"]: + """List all event subscriptions for a specific domain topic. + + List all event subscriptions that have been created for a specific domain topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param domain_name: Name of the top level domain. + :type domain_name: str + :param topic_name: Name of the domain topic. + :type topic_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_domain_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_domain_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py new file mode 100644 index 000000000000..d2ca2ccd71d5 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationsListResult"]: + """List available operations. + + List the available operations supported by the Microsoft.EventGrid resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.OperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.EventGrid/operations'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..3bc688b2993c --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,470 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum14"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnection": + """Get a specific private endpoint connection. + + Get a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum14 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum15"], + parent_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "models.PrivateEndpointConnection", + **kwargs + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum15"], + parent_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + """Update a specific private endpoint connection. + + Update a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum15 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection object to update. + :type private_endpoint_connection: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum16"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum16"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a specific private endpoint connection. + + Delete a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum16 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_resource( + self, + resource_group_name: str, + parent_type: Union[str, "models.Enum17"], + parent_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + """Lists all private endpoint connections under a resource. + + Get all private endpoint connections under a topic or domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum17 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..7e2c9c71e7cf --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,211 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + parent_type: str, + parent_name: str, + private_link_resource_name: str, + **kwargs + ) -> "models.PrivateLinkResource": + """Get a private link resource. + + Get properties of a private link resource. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param private_link_resource_name: The name of private link resource. + :type private_link_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + + def list_by_resource( + self, + resource_group_name: str, + parent_type: str, + parent_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.PrivateLinkResourcesListResult"]: + """List private link resources under specific topic or domain. + + List all the private link resources under a topic or domain. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). + :type parent_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py new file mode 100644 index 000000000000..0c1f1f1e9c2a --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py @@ -0,0 +1,232 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicTypesOperations: + """TopicTypesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.TopicTypesListResult"]: + """List topic types. + + List all registered topic types. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicTypesListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.TopicTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TopicTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes'} # type: ignore + + async def get( + self, + topic_type_name: str, + **kwargs + ) -> "models.TopicTypeInfo": + """Get a topic type. + + Get information about a topic type. + + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicTypeInfo, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicTypeInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicTypeInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}'} # type: ignore + + def list_event_types( + self, + topic_type_name: str, + **kwargs + ) -> AsyncIterable["models.EventTypesListResult"]: + """List event types. + + List event types for a topic type. + + :param topic_type_name: Name of the topic type. + :type topic_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_types.metadata['url'] # type: ignore + path_format_arguments = { + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_event_types.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..f2a998712a90 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py @@ -0,0 +1,836 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + topic_name: str, + **kwargs + ) -> "models.Topic": + """Get a topic. + + Get properties of a topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Topic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + topic_name: str, + topic_info: "models.Topic", + **kwargs + ) -> "models.Topic": + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(topic_info, 'Topic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + topic_name: str, + topic_info: "models.Topic", + **kwargs + ) -> AsyncLROPoller["models.Topic"]: + """Create a topic. + + Asynchronously creates a new topic with the specified parameters. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :param topic_info: Topic information. + :type topic_info: ~azure.mgmt.eventgrid.models.Topic + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Topic or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Topic] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + topic_info=topic_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + topic_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + topic_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a topic. + + Delete existing topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + topic_name: str, + topic_update_parameters: "models.TopicUpdateParameters", + **kwargs + ) -> Optional["models.Topic"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Topic"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + topic_name: str, + topic_update_parameters: "models.TopicUpdateParameters", + **kwargs + ) -> AsyncLROPoller["models.Topic"]: + """Update a topic. + + Asynchronously updates a topic with the specified parameters. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :param topic_update_parameters: Topic update information. + :type topic_update_parameters: ~azure.mgmt.eventgrid.models.TopicUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + topic_update_parameters=topic_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.TopicsListResult"]: + """List topics under an Azure subscription. + + List all the topics under an Azure subscription. + + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.TopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.TopicsListResult"]: + """List topics under a resource group. + + List all the topics under a resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.TopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'} # type: ignore + + async def list_shared_access_keys( + self, + resource_group_name: str, + topic_name: str, + **kwargs + ) -> "models.TopicSharedAccessKeys": + """List keys for a topic. + + List the two keys used to publish to a topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.list_shared_access_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'} # type: ignore + + async def regenerate_key( + self, + resource_group_name: str, + topic_name: str, + key_name: str, + **kwargs + ) -> "models.TopicSharedAccessKeys": + """Regenerate key for a topic. + + Regenerate a shared access key for a topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param topic_name: Name of the topic. + :type topic_name: str + :param key_name: Key name to regenerate key1 or key2. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _regenerate_key_request = models.TopicRegenerateKeyRequest(key_name=key_name) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_regenerate_key_request, 'TopicRegenerateKeyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore + + def list_event_types( + self, + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["models.EventTypesListResult"]: + """List topic event types. + + List event types for a topic. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param provider_namespace: Namespace of the provider of the topic. + :type provider_namespace: str + :param resource_type_name: Name of the topic type. + :type resource_type_name: str + :param resource_name: Name of the topic. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_types.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), + 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_event_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py index 8c67cc73bd6a..684f906d3b4f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: @@ -15,28 +12,23 @@ from ._models_py3 import BoolEqualsAdvancedFilter from ._models_py3 import ConnectionState from ._models_py3 import DeadLetterDestination - from ._models_py3 import DeadLetterWithResourceIdentity - from ._models_py3 import DeliveryWithResourceIdentity from ._models_py3 import Domain from ._models_py3 import DomainRegenerateKeyRequest from ._models_py3 import DomainSharedAccessKeys from ._models_py3 import DomainTopic + from ._models_py3 import DomainTopicsListResult from ._models_py3 import DomainUpdateParameters - from ._models_py3 import EventChannel - from ._models_py3 import EventChannelDestination - from ._models_py3 import EventChannelFilter - from ._models_py3 import EventChannelSource + from ._models_py3 import DomainsListResult from ._models_py3 import EventHubEventSubscriptionDestination from ._models_py3 import EventSubscription from ._models_py3 import EventSubscriptionDestination from ._models_py3 import EventSubscriptionFilter from ._models_py3 import EventSubscriptionFullUrl - from ._models_py3 import EventSubscriptionIdentity from ._models_py3 import EventSubscriptionUpdateParameters + from ._models_py3 import EventSubscriptionsListResult from ._models_py3 import EventType - from ._models_py3 import ExtensionTopic + from ._models_py3 import EventTypesListResult from ._models_py3 import HybridConnectionEventSubscriptionDestination - from ._models_py3 import IdentityInfo from ._models_py3 import InboundIpRule from ._models_py3 import InputSchemaMapping from ._models_py3 import JsonField @@ -50,22 +42,13 @@ from ._models_py3 import NumberNotInAdvancedFilter from ._models_py3 import Operation from ._models_py3 import OperationInfo - from ._models_py3 import PartnerNamespace - from ._models_py3 import PartnerNamespaceRegenerateKeyRequest - from ._models_py3 import PartnerNamespaceSharedAccessKeys - from ._models_py3 import PartnerNamespaceUpdateParameters - from ._models_py3 import PartnerRegistration - from ._models_py3 import PartnerRegistrationEventTypesListResult - from ._models_py3 import PartnerRegistrationUpdateParameters - from ._models_py3 import PartnerTopic - from ._models_py3 import PartnerTopicType - from ._models_py3 import PartnerTopicTypesListResult - from ._models_py3 import PartnerTopicUpdateParameters + from ._models_py3 import OperationsListResult from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourcesListResult from ._models_py3 import Resource - from ._models_py3 import ResourceSku from ._models_py3 import RetryPolicy from ._models_py3 import ServiceBusQueueEventSubscriptionDestination from ._models_py3 import ServiceBusTopicEventSubscriptionDestination @@ -76,130 +59,98 @@ from ._models_py3 import StringEndsWithAdvancedFilter from ._models_py3 import StringInAdvancedFilter from ._models_py3 import StringNotInAdvancedFilter - from ._models_py3 import SystemTopic - from ._models_py3 import SystemTopicUpdateParameters from ._models_py3 import Topic from ._models_py3 import TopicRegenerateKeyRequest from ._models_py3 import TopicSharedAccessKeys from ._models_py3 import TopicTypeInfo + from ._models_py3 import TopicTypesListResult from ._models_py3 import TopicUpdateParameters + from ._models_py3 import TopicsListResult from ._models_py3 import TrackedResource - from ._models_py3 import UserIdentityProperties from ._models_py3 import WebHookEventSubscriptionDestination except (SyntaxError, ImportError): - from ._models import AdvancedFilter - from ._models import AzureFunctionEventSubscriptionDestination - from ._models import BoolEqualsAdvancedFilter - from ._models import ConnectionState - from ._models import DeadLetterDestination - from ._models import DeadLetterWithResourceIdentity - from ._models import DeliveryWithResourceIdentity - from ._models import Domain - from ._models import DomainRegenerateKeyRequest - from ._models import DomainSharedAccessKeys - from ._models import DomainTopic - from ._models import DomainUpdateParameters - from ._models import EventChannel - from ._models import EventChannelDestination - from ._models import EventChannelFilter - from ._models import EventChannelSource - from ._models import EventHubEventSubscriptionDestination - from ._models import EventSubscription - from ._models import EventSubscriptionDestination - from ._models import EventSubscriptionFilter - from ._models import EventSubscriptionFullUrl - from ._models import EventSubscriptionIdentity - from ._models import EventSubscriptionUpdateParameters - from ._models import EventType - from ._models import ExtensionTopic - from ._models import HybridConnectionEventSubscriptionDestination - from ._models import IdentityInfo - from ._models import InboundIpRule - from ._models import InputSchemaMapping - from ._models import JsonField - from ._models import JsonFieldWithDefault - from ._models import JsonInputSchemaMapping - from ._models import NumberGreaterThanAdvancedFilter - from ._models import NumberGreaterThanOrEqualsAdvancedFilter - from ._models import NumberInAdvancedFilter - from ._models import NumberLessThanAdvancedFilter - from ._models import NumberLessThanOrEqualsAdvancedFilter - from ._models import NumberNotInAdvancedFilter - from ._models import Operation - from ._models import OperationInfo - from ._models import PartnerNamespace - from ._models import PartnerNamespaceRegenerateKeyRequest - from ._models import PartnerNamespaceSharedAccessKeys - from ._models import PartnerNamespaceUpdateParameters - from ._models import PartnerRegistration - from ._models import PartnerRegistrationEventTypesListResult - from ._models import PartnerRegistrationUpdateParameters - from ._models import PartnerTopic - from ._models import PartnerTopicType - from ._models import PartnerTopicTypesListResult - from ._models import PartnerTopicUpdateParameters - from ._models import PrivateEndpoint - from ._models import PrivateEndpointConnection - from ._models import PrivateLinkResource - from ._models import Resource - from ._models import ResourceSku - from ._models import RetryPolicy - from ._models import ServiceBusQueueEventSubscriptionDestination - from ._models import ServiceBusTopicEventSubscriptionDestination - from ._models import StorageBlobDeadLetterDestination - from ._models import StorageQueueEventSubscriptionDestination - from ._models import StringBeginsWithAdvancedFilter - from ._models import StringContainsAdvancedFilter - from ._models import StringEndsWithAdvancedFilter - from ._models import StringInAdvancedFilter - from ._models import StringNotInAdvancedFilter - from ._models import SystemTopic - from ._models import SystemTopicUpdateParameters - from ._models import Topic - from ._models import TopicRegenerateKeyRequest - from ._models import TopicSharedAccessKeys - from ._models import TopicTypeInfo - from ._models import TopicUpdateParameters - from ._models import TrackedResource - from ._models import UserIdentityProperties - from ._models import WebHookEventSubscriptionDestination -from ._paged_models import DomainPaged -from ._paged_models import DomainTopicPaged -from ._paged_models import EventChannelPaged -from ._paged_models import EventSubscriptionPaged -from ._paged_models import EventTypePaged -from ._paged_models import OperationPaged -from ._paged_models import PartnerNamespacePaged -from ._paged_models import PartnerRegistrationPaged -from ._paged_models import PartnerTopicPaged -from ._paged_models import PrivateEndpointConnectionPaged -from ._paged_models import PrivateLinkResourcePaged -from ._paged_models import SystemTopicPaged -from ._paged_models import TopicPaged -from ._paged_models import TopicTypeInfoPaged + from ._models import AdvancedFilter # type: ignore + from ._models import AzureFunctionEventSubscriptionDestination # type: ignore + from ._models import BoolEqualsAdvancedFilter # type: ignore + from ._models import ConnectionState # type: ignore + from ._models import DeadLetterDestination # type: ignore + from ._models import Domain # type: ignore + from ._models import DomainRegenerateKeyRequest # type: ignore + from ._models import DomainSharedAccessKeys # type: ignore + from ._models import DomainTopic # type: ignore + from ._models import DomainTopicsListResult # type: ignore + from ._models import DomainUpdateParameters # type: ignore + from ._models import DomainsListResult # type: ignore + from ._models import EventHubEventSubscriptionDestination # type: ignore + from ._models import EventSubscription # type: ignore + from ._models import EventSubscriptionDestination # type: ignore + from ._models import EventSubscriptionFilter # type: ignore + from ._models import EventSubscriptionFullUrl # type: ignore + from ._models import EventSubscriptionUpdateParameters # type: ignore + from ._models import EventSubscriptionsListResult # type: ignore + from ._models import EventType # type: ignore + from ._models import EventTypesListResult # type: ignore + from ._models import HybridConnectionEventSubscriptionDestination # type: ignore + from ._models import InboundIpRule # type: ignore + from ._models import InputSchemaMapping # type: ignore + from ._models import JsonField # type: ignore + from ._models import JsonFieldWithDefault # type: ignore + from ._models import JsonInputSchemaMapping # type: ignore + from ._models import NumberGreaterThanAdvancedFilter # type: ignore + from ._models import NumberGreaterThanOrEqualsAdvancedFilter # type: ignore + from ._models import NumberInAdvancedFilter # type: ignore + from ._models import NumberLessThanAdvancedFilter # type: ignore + from ._models import NumberLessThanOrEqualsAdvancedFilter # type: ignore + from ._models import NumberNotInAdvancedFilter # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationInfo # type: ignore + from ._models import OperationsListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourcesListResult # type: ignore + from ._models import Resource # type: ignore + from ._models import RetryPolicy # type: ignore + from ._models import ServiceBusQueueEventSubscriptionDestination # type: ignore + from ._models import ServiceBusTopicEventSubscriptionDestination # type: ignore + from ._models import StorageBlobDeadLetterDestination # type: ignore + from ._models import StorageQueueEventSubscriptionDestination # type: ignore + from ._models import StringBeginsWithAdvancedFilter # type: ignore + from ._models import StringContainsAdvancedFilter # type: ignore + from ._models import StringEndsWithAdvancedFilter # type: ignore + from ._models import StringInAdvancedFilter # type: ignore + from ._models import StringNotInAdvancedFilter # type: ignore + from ._models import Topic # type: ignore + from ._models import TopicRegenerateKeyRequest # type: ignore + from ._models import TopicSharedAccessKeys # type: ignore + from ._models import TopicTypeInfo # type: ignore + from ._models import TopicTypesListResult # type: ignore + from ._models import TopicUpdateParameters # type: ignore + from ._models import TopicsListResult # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import WebHookEventSubscriptionDestination # type: ignore + from ._event_grid_management_client_enums import ( - PersistedConnectionStatus, - ResourceProvisioningState, + AdvancedFilterOperatorType, + DeadLetterEndPointType, DomainProvisioningState, - InputSchema, - PublicNetworkAccess, - IpActionType, - Sku, - IdentityType, DomainTopicProvisioningState, - EventChannelProvisioningState, - PartnerTopicReadinessState, - EventSubscriptionProvisioningState, - EventSubscriptionIdentityType, + EndpointType, + Enum14, + Enum15, + Enum16, + Enum17, EventDeliverySchema, - PartnerNamespaceProvisioningState, - PartnerRegistrationProvisioningState, - PartnerRegistrationVisibilityState, - PartnerTopicProvisioningState, - PartnerTopicActivationState, - PartnerTopicTypeAuthorizationState, - TopicProvisioningState, + EventSubscriptionProvisioningState, + InputSchema, + InputSchemaMappingType, + IpActionType, + PersistedConnectionStatus, + PublicNetworkAccess, + ResourceProvisioningState, ResourceRegionType, + TopicProvisioningState, TopicTypeProvisioningState, ) @@ -209,28 +160,23 @@ 'BoolEqualsAdvancedFilter', 'ConnectionState', 'DeadLetterDestination', - 'DeadLetterWithResourceIdentity', - 'DeliveryWithResourceIdentity', 'Domain', 'DomainRegenerateKeyRequest', 'DomainSharedAccessKeys', 'DomainTopic', + 'DomainTopicsListResult', 'DomainUpdateParameters', - 'EventChannel', - 'EventChannelDestination', - 'EventChannelFilter', - 'EventChannelSource', + 'DomainsListResult', 'EventHubEventSubscriptionDestination', 'EventSubscription', 'EventSubscriptionDestination', 'EventSubscriptionFilter', 'EventSubscriptionFullUrl', - 'EventSubscriptionIdentity', 'EventSubscriptionUpdateParameters', + 'EventSubscriptionsListResult', 'EventType', - 'ExtensionTopic', + 'EventTypesListResult', 'HybridConnectionEventSubscriptionDestination', - 'IdentityInfo', 'InboundIpRule', 'InputSchemaMapping', 'JsonField', @@ -244,22 +190,13 @@ 'NumberNotInAdvancedFilter', 'Operation', 'OperationInfo', - 'PartnerNamespace', - 'PartnerNamespaceRegenerateKeyRequest', - 'PartnerNamespaceSharedAccessKeys', - 'PartnerNamespaceUpdateParameters', - 'PartnerRegistration', - 'PartnerRegistrationEventTypesListResult', - 'PartnerRegistrationUpdateParameters', - 'PartnerTopic', - 'PartnerTopicType', - 'PartnerTopicTypesListResult', - 'PartnerTopicUpdateParameters', + 'OperationsListResult', 'PrivateEndpoint', 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', 'Resource', - 'ResourceSku', 'RetryPolicy', 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopicEventSubscriptionDestination', @@ -270,51 +207,33 @@ 'StringEndsWithAdvancedFilter', 'StringInAdvancedFilter', 'StringNotInAdvancedFilter', - 'SystemTopic', - 'SystemTopicUpdateParameters', 'Topic', 'TopicRegenerateKeyRequest', 'TopicSharedAccessKeys', 'TopicTypeInfo', + 'TopicTypesListResult', 'TopicUpdateParameters', + 'TopicsListResult', 'TrackedResource', - 'UserIdentityProperties', 'WebHookEventSubscriptionDestination', - 'DomainPaged', - 'DomainTopicPaged', - 'EventChannelPaged', - 'EventSubscriptionPaged', - 'OperationPaged', - 'PartnerNamespacePaged', - 'PartnerRegistrationPaged', - 'PartnerTopicPaged', - 'PrivateEndpointConnectionPaged', - 'PrivateLinkResourcePaged', - 'SystemTopicPaged', - 'TopicPaged', - 'EventTypePaged', - 'TopicTypeInfoPaged', - 'PersistedConnectionStatus', - 'ResourceProvisioningState', + 'AdvancedFilterOperatorType', + 'DeadLetterEndPointType', 'DomainProvisioningState', - 'InputSchema', - 'PublicNetworkAccess', - 'IpActionType', - 'Sku', - 'IdentityType', 'DomainTopicProvisioningState', - 'EventChannelProvisioningState', - 'PartnerTopicReadinessState', - 'EventSubscriptionProvisioningState', - 'EventSubscriptionIdentityType', + 'EndpointType', + 'Enum14', + 'Enum15', + 'Enum16', + 'Enum17', 'EventDeliverySchema', - 'PartnerNamespaceProvisioningState', - 'PartnerRegistrationProvisioningState', - 'PartnerRegistrationVisibilityState', - 'PartnerTopicProvisioningState', - 'PartnerTopicActivationState', - 'PartnerTopicTypeAuthorizationState', - 'TopicProvisioningState', + 'EventSubscriptionProvisioningState', + 'InputSchema', + 'InputSchemaMappingType', + 'IpActionType', + 'PersistedConnectionStatus', + 'PublicNetworkAccess', + 'ResourceProvisioningState', 'ResourceRegionType', + 'TopicProvisioningState', 'TopicTypeProvisioningState', ] diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py index 99687c96b4e7..255939f5712b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py @@ -1,201 +1,204 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AdvancedFilterOperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. + """ + + NUMBER_IN = "NumberIn" + NUMBER_NOT_IN = "NumberNotIn" + NUMBER_LESS_THAN = "NumberLessThan" + NUMBER_GREATER_THAN = "NumberGreaterThan" + NUMBER_LESS_THAN_OR_EQUALS = "NumberLessThanOrEquals" + NUMBER_GREATER_THAN_OR_EQUALS = "NumberGreaterThanOrEquals" + BOOL_EQUALS = "BoolEquals" + STRING_IN = "StringIn" + STRING_NOT_IN = "StringNotIn" + STRING_BEGINS_WITH = "StringBeginsWith" + STRING_ENDS_WITH = "StringEndsWith" + STRING_CONTAINS = "StringContains" + +class DeadLetterEndPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the endpoint for the dead letter destination + """ + + STORAGE_BLOB = "StorageBlob" + +class DomainProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the domain. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class DomainTopicProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the domain topic. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the endpoint for the event subscription destination. + """ + + WEB_HOOK = "WebHook" + EVENT_HUB = "EventHub" + STORAGE_QUEUE = "StorageQueue" + HYBRID_CONNECTION = "HybridConnection" + SERVICE_BUS_QUEUE = "ServiceBusQueue" + SERVICE_BUS_TOPIC = "ServiceBusTopic" + AZURE_FUNCTION = "AzureFunction" + +class Enum14(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + TOPICS = "topics" + DOMAINS = "domains" + +class Enum15(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + TOPICS = "topics" + DOMAINS = "domains" + +class Enum16(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + TOPICS = "topics" + DOMAINS = "domains" + +class Enum17(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + TOPICS = "topics" + DOMAINS = "domains" + +class EventDeliverySchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The event delivery schema for the event subscription. + """ + + EVENT_GRID_SCHEMA = "EventGridSchema" + CUSTOM_INPUT_SCHEMA = "CustomInputSchema" + CLOUD_EVENT_SCHEMA_V1_0 = "CloudEventSchemaV1_0" + +class EventSubscriptionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the event subscription. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + AWAITING_MANUAL_ACTION = "AwaitingManualAction" + +class InputSchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This determines the format that Event Grid should expect for incoming events published to the + domain. + """ + + EVENT_GRID_SCHEMA = "EventGridSchema" + CUSTOM_EVENT_SCHEMA = "CustomEventSchema" + CLOUD_EVENT_SCHEMA_V1_0 = "CloudEventSchemaV1_0" + +class InputSchemaMappingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the custom mapping + """ + + JSON = "Json" + +class IpActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Action to perform based on the match or no match of the IpMask. + """ + + ALLOW = "Allow" + +class PersistedConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the connection. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This determines if traffic is allowed over public network. By default it is enabled. + You can further restrict to specific IPs by configuring :code:`` + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Private Endpoint Connection. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class ResourceRegionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Region type of the resource. + """ + + REGIONAL_RESOURCE = "RegionalResource" + GLOBAL_RESOURCE = "GlobalResource" +class TopicProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the topic. + """ -class PersistedConnectionStatus(str, Enum): - - pending = "Pending" - approved = "Approved" - rejected = "Rejected" - disconnected = "Disconnected" - - -class ResourceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class DomainProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class InputSchema(str, Enum): - - event_grid_schema = "EventGridSchema" - custom_event_schema = "CustomEventSchema" - cloud_event_schema_v1_0 = "CloudEventSchemaV1_0" - - -class PublicNetworkAccess(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - -class IpActionType(str, Enum): - - allow = "Allow" - - -class Sku(str, Enum): - - basic = "Basic" - premium = "Premium" - - -class IdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned, UserAssigned" - - -class DomainTopicProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class EventChannelProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class PartnerTopicReadinessState(str, Enum): - - not_activated_by_user_yet = "NotActivatedByUserYet" - activated_by_user = "ActivatedByUser" - deactivated_by_user = "DeactivatedByUser" - deleted_by_user = "DeletedByUser" - - -class EventSubscriptionProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - awaiting_manual_action = "AwaitingManualAction" - - -class EventSubscriptionIdentityType(str, Enum): - - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - - -class EventDeliverySchema(str, Enum): - - event_grid_schema = "EventGridSchema" - custom_input_schema = "CustomInputSchema" - cloud_event_schema_v1_0 = "CloudEventSchemaV1_0" - - -class PartnerNamespaceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class PartnerRegistrationProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class PartnerRegistrationVisibilityState(str, Enum): - - hidden = "Hidden" - public_preview = "PublicPreview" - generally_available = "GenerallyAvailable" - - -class PartnerTopicProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class PartnerTopicActivationState(str, Enum): - - never_activated = "NeverActivated" - activated = "Activated" - deactivated = "Deactivated" - - -class PartnerTopicTypeAuthorizationState(str, Enum): - - not_applicable = "NotApplicable" - not_authorized = "NotAuthorized" - authorized = "Authorized" - - -class TopicProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" - - -class ResourceRegionType(str, Enum): - - regional_resource = "RegionalResource" - global_resource = "GlobalResource" - - -class TopicTypeProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - canceled = "Canceled" - failed = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class TopicTypeProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the topic type + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py index abaa4eba8cac..4c1c6173fcb6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py @@ -1,41 +1,30 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import msrest.serialization -class AdvancedFilter(Model): - """This is the base type that represents an advanced filter. To configure an - advanced filter, do not directly instantiate an object of this class. - Instead, instantiate an object of a derived class such as - BoolEqualsAdvancedFilter, NumberInAdvancedFilter, - StringEqualsAdvancedFilter etc. depending on the type of the key based on - which you want to filter. +class AdvancedFilter(msrest.serialization.Model): + """This is the base type that represents an advanced filter. To configure an advanced filter, do not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key based on which you want to filter. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: NumberInAdvancedFilter, NumberNotInAdvancedFilter, - NumberLessThanAdvancedFilter, NumberGreaterThanAdvancedFilter, - NumberLessThanOrEqualsAdvancedFilter, - NumberGreaterThanOrEqualsAdvancedFilter, BoolEqualsAdvancedFilter, - StringInAdvancedFilter, StringNotInAdvancedFilter, - StringBeginsWithAdvancedFilter, StringEndsWithAdvancedFilter, - StringContainsAdvancedFilter + sub-classes are: BoolEqualsAdvancedFilter, NumberGreaterThanAdvancedFilter, NumberGreaterThanOrEqualsAdvancedFilter, NumberInAdvancedFilter, NumberLessThanAdvancedFilter, NumberLessThanOrEqualsAdvancedFilter, NumberNotInAdvancedFilter, StringBeginsWithAdvancedFilter, StringContainsAdvancedFilter, StringEndsWithAdvancedFilter, StringInAdvancedFilter, StringNotInAdvancedFilter. All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str """ _validation = { @@ -43,36 +32,35 @@ class AdvancedFilter(Model): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, } _subtype_map = { - 'operator_type': {'NumberIn': 'NumberInAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'BoolEquals': 'BoolEqualsAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter'} + 'operator_type': {'BoolEquals': 'BoolEqualsAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberIn': 'NumberInAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AdvancedFilter, self).__init__(**kwargs) + self.operator_type = None # type: Optional[str] self.key = kwargs.get('key', None) - self.operator_type = None -class EventSubscriptionDestination(Model): +class EventSubscriptionDestination(msrest.serialization.Model): """Information about the destination for an event subscription. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: WebHookEventSubscriptionDestination, - EventHubEventSubscriptionDestination, - StorageQueueEventSubscriptionDestination, - HybridConnectionEventSubscriptionDestination, - ServiceBusQueueEventSubscriptionDestination, - ServiceBusTopicEventSubscriptionDestination, - AzureFunctionEventSubscriptionDestination + sub-classes are: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType """ _validation = { @@ -84,12 +72,15 @@ class EventSubscriptionDestination(Model): } _subtype_map = { - 'endpoint_type': {'WebHook': 'WebHookEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'AzureFunction': 'AzureFunctionEventSubscriptionDestination'} + 'endpoint_type': {'AzureFunction': 'AzureFunctionEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'WebHook': 'WebHookEventSubscriptionDestination'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = None + self.endpoint_type = None # type: Optional[str] class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): @@ -97,15 +88,16 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Azure Function destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Azure Function + destination of an event subscription. :type resource_id: str :param max_events_per_batch: Maximum number of events per batch. :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in - Kilobytes. + :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. :type preferred_batch_size_in_kilobytes: int """ @@ -120,12 +112,15 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): 'preferred_batch_size_in_kilobytes': {'key': 'properties.preferredBatchSizeInKilobytes', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureFunctionEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'AzureFunction' # type: str self.resource_id = kwargs.get('resource_id', None) self.max_events_per_batch = kwargs.get('max_events_per_batch', None) self.preferred_batch_size_in_kilobytes = kwargs.get('preferred_batch_size_in_kilobytes', None) - self.endpoint_type = 'AzureFunction' class BoolEqualsAdvancedFilter(AdvancedFilter): @@ -133,11 +128,14 @@ class BoolEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The boolean filter value. :type value: bool """ @@ -147,32 +145,26 @@ class BoolEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BoolEqualsAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'BoolEquals' # type: str self.value = kwargs.get('value', None) - self.operator_type = 'BoolEquals' - - -class CloudError(Model): - """CloudError. - """ - _attribute_map = { - } - -class ConnectionState(Model): +class ConnectionState(msrest.serialization.Model): """ConnectionState information. - :param status: Status of the connection. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' - :type status: str or - ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus :param description: Description of the connection state. :type description: str :param actions_required: Actions required (if any). @@ -185,27 +177,27 @@ class ConnectionState(Model): 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.actions_required = kwargs.get('actions_required', None) -class DeadLetterDestination(Model): - """Information about the dead letter destination for an event subscription. To - configure a deadletter destination, do not directly instantiate an object - of this class. Instead, instantiate an object of a derived class. - Currently, StorageBlobDeadLetterDestination is the only class that derives - from this class. +class DeadLetterDestination(msrest.serialization.Model): + """Information about the dead letter destination for an event subscription. To configure a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StorageBlobDeadLetterDestination + sub-classes are: StorageBlobDeadLetterDestination. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str + :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType """ _validation = { @@ -220,72 +212,24 @@ class DeadLetterDestination(Model): 'endpoint_type': {'StorageBlob': 'StorageBlobDeadLetterDestination'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeadLetterDestination, self).__init__(**kwargs) - self.endpoint_type = None - - -class DeadLetterWithResourceIdentity(Model): - """Information about the deadletter destination with resource identity. - - :param identity: The identity to use when dead-lettering events. - :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :param dead_letter_destination: Information about the destination where - events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, - 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, - } - - def __init__(self, **kwargs): - super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.dead_letter_destination = kwargs.get('dead_letter_destination', None) - - -class DeliveryWithResourceIdentity(Model): - """Information about the delivery for an event subscription with resource - identity. - - :param identity: The identity to use when delivering events. - :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, - 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, - } - - def __init__(self, **kwargs): - super(DeliveryWithResourceIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.destination = kwargs.get('destination', None) + self.endpoint_type = None # type: Optional[str] -class Resource(Model): +class Resource(msrest.serialization.Model): """Definition of a Resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str """ @@ -301,7 +245,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -311,20 +258,19 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """Definition of a Tracked Resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] """ @@ -343,66 +289,58 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) class Domain(TrackedResource): """EventGrid Domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] :param private_endpoint_connections: List of private endpoint connections. :type private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar provisioning_state: Provisioning state of the domain. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.DomainProvisioningState + :ivar provisioning_state: Provisioning state of the domain. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainProvisioningState :ivar endpoint: Endpoint for the domain. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should - expect for incoming events published to the domain. Possible values - include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventSchemaV1_0'. - Default value: "EventGridSchema" . + :param input_schema: This determines the format that Event Grid should expect for incoming + events published to the domain. Possible values include: "EventGridSchema", + "CustomEventSchema", "CloudEventSchemaV1_0". :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: Information about the InputSchemaMapping - which specified the info about mapping event payload. - :type input_schema_mapping: - ~azure.mgmt.eventgrid.models.InputSchemaMapping + :param input_schema_mapping: Information about the InputSchemaMapping which specified the info + about mapping event payload. + :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the domain. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the domain. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -429,25 +367,24 @@ class Domain(TrackedResource): 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Domain, self).__init__(**kwargs) self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) self.provisioning_state = None self.endpoint = None - self.input_schema = kwargs.get('input_schema', "EventGridSchema") + self.input_schema = kwargs.get('input_schema', None) self.input_schema_mapping = kwargs.get('input_schema_mapping', None) self.metric_resource_id = None self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) -class DomainRegenerateKeyRequest(Model): +class DomainRegenerateKeyRequest(msrest.serialization.Model): """Domain regenerate share access key request. All required parameters must be populated in order to send to Azure. @@ -464,12 +401,15 @@ class DomainRegenerateKeyRequest(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) + self.key_name = kwargs['key_name'] -class DomainSharedAccessKeys(Model): +class DomainSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Domain. :param key1: Shared access key1 for the domain. @@ -483,227 +423,128 @@ class DomainSharedAccessKeys(Model): 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DomainSharedAccessKeys, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) -class DomainTopic(Resource): - """Domain Topic. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param provisioning_state: Provisioning state of the domain topic. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.DomainTopicProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DomainTopic, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class DomainUpdateParameters(Model): - """Properties of the Domain update. +class DomainsListResult(msrest.serialization.Model): + """Result of the List Domains operation. - :param tags: Tags of the domains resource. - :type tags: dict[str, str] - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param sku: The Sku pricing tier for the domain. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param value: A collection of Domains. + :type value: list[~azure.mgmt.eventgrid.models.Domain] + :param next_link: A link for the next page of domains. + :type next_link: str """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(DomainUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) - self.identity = kwargs.get('identity', None) - self.sku = kwargs.get('sku', None) + def __init__( + self, + **kwargs + ): + super(DomainsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class EventChannel(Resource): - """Event Channel. +class DomainTopic(Resource): + """Domain Topic. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str - :param source: Source of the event channel. This represents a unique - resource in the partner's resource model. - :type source: ~azure.mgmt.eventgrid.models.EventChannelSource - :param destination: Represents the destination of an event channel. - :type destination: ~azure.mgmt.eventgrid.models.EventChannelDestination - :ivar provisioning_state: Provisioning state of the event channel. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.EventChannelProvisioningState - :ivar partner_topic_readiness_state: The readiness state of the - corresponding partner topic. Possible values include: - 'NotActivatedByUserYet', 'ActivatedByUser', 'DeactivatedByUser', - 'DeletedByUser' - :vartype partner_topic_readiness_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicReadinessState - :param expiration_time_if_not_activated_utc: Expiration time of the event - channel. If this timer expires while the corresponding partner topic is - never activated, - the event channel and corresponding partner topic are deleted. - :type expiration_time_if_not_activated_utc: datetime - :param filter: Information about the filter for the event channel. - :type filter: ~azure.mgmt.eventgrid.models.EventChannelFilter - :param partner_topic_friendly_description: Friendly description about the - topic. This can be set by the publisher/partner to show custom description - for the customer partner topic. - This will be helpful to remove any ambiguity of the origin of creation of - the partner topic for the customer. - :type partner_topic_friendly_description: str + :param provisioning_state: Provisioning state of the domain topic. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainTopicProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'partner_topic_readiness_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'EventChannelSource'}, - 'destination': {'key': 'properties.destination', 'type': 'EventChannelDestination'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_topic_readiness_state': {'key': 'properties.partnerTopicReadinessState', 'type': 'str'}, - 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, - 'filter': {'key': 'properties.filter', 'type': 'EventChannelFilter'}, - 'partner_topic_friendly_description': {'key': 'properties.partnerTopicFriendlyDescription', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(EventChannel, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.destination = kwargs.get('destination', None) - self.provisioning_state = None - self.partner_topic_readiness_state = None - self.expiration_time_if_not_activated_utc = kwargs.get('expiration_time_if_not_activated_utc', None) - self.filter = kwargs.get('filter', None) - self.partner_topic_friendly_description = kwargs.get('partner_topic_friendly_description', None) - - -class EventChannelDestination(Model): - """Properties of the destination of an event channel. - - :param azure_subscription_id: Azure subscription ID of the customer - creating the event channel. The partner topic - associated with the event channel will be created under this Azure - subscription. - :type azure_subscription_id: str - :param resource_group: Azure Resource Group of the customer creating the - event channel. The partner topic - associated with the event channel will be created under this resource - group. - :type resource_group: str - :param partner_topic_name: Name of the partner topic associated with the - event channel. - :type partner_topic_name: str - """ - - _attribute_map = { - 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'partner_topic_name': {'key': 'partnerTopicName', 'type': 'str'}, } - def __init__(self, **kwargs): - super(EventChannelDestination, self).__init__(**kwargs) - self.azure_subscription_id = kwargs.get('azure_subscription_id', None) - self.resource_group = kwargs.get('resource_group', None) - self.partner_topic_name = kwargs.get('partner_topic_name', None) + def __init__( + self, + **kwargs + ): + super(DomainTopic, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) -class EventChannelFilter(Model): - """Filter for the Event Channel. +class DomainTopicsListResult(msrest.serialization.Model): + """Result of the List Domain Topics operation. - :param advanced_filters: An array of advanced filters that are used for - filtering event channels. - :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + :param value: A collection of Domain Topics. + :type value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :param next_link: A link for the next page of domain topics. + :type next_link: str """ _attribute_map = { - 'advanced_filters': {'key': 'advancedFilters', 'type': '[AdvancedFilter]'}, + 'value': {'key': 'value', 'type': '[DomainTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(EventChannelFilter, self).__init__(**kwargs) - self.advanced_filters = kwargs.get('advanced_filters', None) + def __init__( + self, + **kwargs + ): + super(DomainTopicsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class EventChannelSource(Model): - """Properties of the source of an event channel. +class DomainUpdateParameters(msrest.serialization.Model): + """Properties of the Domain update. - :param source: The identifier of the resource that's the source of the - events. - This represents a unique resource in the partner's resource model. - :type source: str + :param tags: A set of tags. Tags of the domains resource. + :type tags: dict[str, str] + :param public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] """ _attribute_map = { - 'source': {'key': 'source', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, } - def __init__(self, **kwargs): - super(EventChannelSource, self).__init__(**kwargs) - self.source = kwargs.get('source', None) + def __init__( + self, + **kwargs + ): + super(DomainUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) class EventHubEventSubscriptionDestination(EventSubscriptionDestination): @@ -711,10 +552,12 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - an Event Hub destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + destination of an event subscription. :type resource_id: str """ @@ -727,73 +570,50 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventHubEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'EventHub' # type: str self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'EventHub' class EventSubscription(Resource): """Event Subscription. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :ivar topic: Name of the topic of the event subscription. :vartype topic: str - :ivar provisioning_state: Provisioning state of the event subscription. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed', 'AwaitingManualAction' + :ivar provisioning_state: Provisioning state of the event subscription. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", + "AwaitingManualAction". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination - where events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :param destination: Information about the destination where events have to be delivered for the + event subscription. + :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. :type labels: list[str] :param expiration_time_utc: Expiration time of the event subscription. - :type expiration_time_utc: datetime - :param event_delivery_schema: The event delivery schema for the event - subscription. Possible values include: 'EventGridSchema', - 'CustomInputSchema', 'CloudEventSchemaV1_0' - :type event_delivery_schema: str or - ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to - configure maximum number of delivery attempts and time to live for events. + :type expiration_time_utc: ~datetime.datetime + :param event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :param retry_policy: The retry policy for events. This can be used to configure maximum number + of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The dead letter destination of the event - subscription. Any event that cannot be delivered to its' destination is - sent to the dead letter destination. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of - the event subscription. Any event that cannot be delivered to its' - destination is sent to the dead letter destination. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + :param dead_letter_destination: The DeadLetter destination of the event subscription. + :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination """ _validation = { @@ -811,53 +631,52 @@ class EventSubscription(Resource): 'topic': {'key': 'properties.topic', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'destination': {'key': 'properties.destination', 'type': 'EventSubscriptionDestination'}, - 'delivery_with_resource_identity': {'key': 'properties.deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'properties.filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'properties.labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'properties.expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'properties.eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'properties.retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'properties.deadLetterDestination', 'type': 'DeadLetterDestination'}, - 'dead_letter_with_resource_identity': {'key': 'properties.deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventSubscription, self).__init__(**kwargs) self.topic = None self.provisioning_state = None self.destination = kwargs.get('destination', None) - self.delivery_with_resource_identity = kwargs.get('delivery_with_resource_identity', None) self.filter = kwargs.get('filter', None) self.labels = kwargs.get('labels', None) self.expiration_time_utc = kwargs.get('expiration_time_utc', None) self.event_delivery_schema = kwargs.get('event_delivery_schema', None) self.retry_policy = kwargs.get('retry_policy', None) self.dead_letter_destination = kwargs.get('dead_letter_destination', None) - self.dead_letter_with_resource_identity = kwargs.get('dead_letter_with_resource_identity', None) -class EventSubscriptionFilter(Model): +class EventSubscriptionFilter(msrest.serialization.Model): """Filter for the Event Subscription. - :param subject_begins_with: An optional string to filter events for an - event subscription based on a resource path prefix. + :param subject_begins_with: An optional string to filter events for an event subscription based + on a resource path prefix. The format of this depends on the publisher of the events. Wildcard characters are not supported in this path. :type subject_begins_with: str - :param subject_ends_with: An optional string to filter events for an event - subscription based on a resource path suffix. + :param subject_ends_with: An optional string to filter events for an event subscription based + on a resource path suffix. Wildcard characters are not supported in this path. :type subject_ends_with: str - :param included_event_types: A list of applicable event types that need to - be part of the event subscription. If it is desired to subscribe to all - default event types, set the IncludedEventTypes to null. + :param included_event_types: A list of applicable event types that need to be part of the event + subscription. If it is desired to subscribe to all default event types, set the + IncludedEventTypes to null. :type included_event_types: list[str] - :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and - SubjectEndsWith properties of the filter - should be compared in a case sensitive manner. Default value: False . + :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + properties of the filter + should be compared in a case sensitive manner. :type is_subject_case_sensitive: bool - :param advanced_filters: An array of advanced filters that are used for - filtering event subscriptions. + :param advanced_filters: An array of advanced filters that are used for filtering event + subscriptions. :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] """ @@ -869,7 +688,10 @@ class EventSubscriptionFilter(Model): 'advanced_filters': {'key': 'advancedFilters', 'type': '[AdvancedFilter]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventSubscriptionFilter, self).__init__(**kwargs) self.subject_begins_with = kwargs.get('subject_begins_with', None) self.subject_ends_with = kwargs.get('subject_ends_with', None) @@ -878,11 +700,11 @@ def __init__(self, **kwargs): self.advanced_filters = kwargs.get('advanced_filters', None) -class EventSubscriptionFullUrl(Model): +class EventSubscriptionFullUrl(msrest.serialization.Model): """Full endpoint url of an event subscription. - :param endpoint_url: The URL that represents the endpoint of the - destination of an event subscription. + :param endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. :type endpoint_url: str """ @@ -890,120 +712,93 @@ class EventSubscriptionFullUrl(Model): 'endpoint_url': {'key': 'endpointUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventSubscriptionFullUrl, self).__init__(**kwargs) self.endpoint_url = kwargs.get('endpoint_url', None) -class EventSubscriptionIdentity(Model): - """The identity information with the event subscription. +class EventSubscriptionsListResult(msrest.serialization.Model): + """Result of the List EventSubscriptions operation. - :param type: The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of - user-assigned identities. The type 'None' will remove any identity. - Possible values include: 'SystemAssigned', 'UserAssigned' - :type type: str or - ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType - :param user_assigned_identity: The user identity associated with the - resource. - :type user_assigned_identity: str + :param value: A collection of EventSubscriptions. + :type value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :param next_link: A link for the next page of event subscriptions. + :type next_link: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EventSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(EventSubscriptionIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + def __init__( + self, + **kwargs + ): + super(EventSubscriptionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class EventSubscriptionUpdateParameters(Model): +class EventSubscriptionUpdateParameters(msrest.serialization.Model): """Properties of the Event Subscription update. - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination - where events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (topic / domain) to - acquire the authentication tokens being used during delivery / - dead-lettering. - :type delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :param destination: Information about the destination where events have to be delivered for the + event subscription. + :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. :type labels: list[str] - :param expiration_time_utc: Information about the expiration time for the - event subscription. - :type expiration_time_utc: datetime - :param event_delivery_schema: The event delivery schema for the event - subscription. Possible values include: 'EventGridSchema', - 'CustomInputSchema', 'CloudEventSchemaV1_0' - :type event_delivery_schema: str or - ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to - configure maximum number of delivery attempts and time to live for events. + :param expiration_time_utc: Information about the expiration time for the event subscription. + :type expiration_time_utc: ~datetime.datetime + :param event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :param retry_policy: The retry policy for events. This can be used to configure maximum number + of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The dead letter destination of the event - subscription. Any event that cannot be delivered to its' destination is - sent to the dead letter destination. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of - the event subscription. Any event that cannot be delivered to its' - destination is sent to the dead letter destination. - Uses the managed identity setup on the parent resource (topic / domain) to - acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + :param dead_letter_destination: The DeadLetter destination of the event subscription. + :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination """ _attribute_map = { 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, - 'delivery_with_resource_identity': {'key': 'deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, - 'dead_letter_with_resource_identity': {'key': 'deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventSubscriptionUpdateParameters, self).__init__(**kwargs) self.destination = kwargs.get('destination', None) - self.delivery_with_resource_identity = kwargs.get('delivery_with_resource_identity', None) self.filter = kwargs.get('filter', None) self.labels = kwargs.get('labels', None) self.expiration_time_utc = kwargs.get('expiration_time_utc', None) self.event_delivery_schema = kwargs.get('event_delivery_schema', None) self.retry_policy = kwargs.get('retry_policy', None) self.dead_letter_destination = kwargs.get('dead_letter_destination', None) - self.dead_letter_with_resource_identity = kwargs.get('dead_letter_with_resource_identity', None) class EventType(Resource): """Event Type for a subject under a topic. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param display_name: Display name of the event type. :type display_name: str @@ -1031,7 +826,10 @@ class EventType(Resource): 'is_in_default_set': {'key': 'properties.isInDefaultSet', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EventType, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -1039,56 +837,36 @@ def __init__(self, **kwargs): self.is_in_default_set = kwargs.get('is_in_default_set', None) -class ExtensionTopic(Resource): - """Event grid Extension Topic. This is used for getting Event Grid related - metrics for Azure resources. +class EventTypesListResult(msrest.serialization.Model): + """Result of the List Event Types operation. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param description: Description of the extension topic. - :type description: str - :param system_topic: System topic resource id which is mapped to the - source. - :type system_topic: str + :param value: A collection of event types. + :type value: list[~azure.mgmt.eventgrid.models.EventType] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'system_topic': {'key': 'properties.systemTopic', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EventType]'}, } - def __init__(self, **kwargs): - super(ExtensionTopic, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.system_topic = kwargs.get('system_topic', None) + def __init__( + self, + **kwargs + ): + super(EventTypesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the HybridConnection destination for an event - subscription. + """Information about the HybridConnection destination for an event subscription. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of an hybrid connection that is - the destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource ID of an hybrid connection that is the destination of an + event subscription. :type resource_id: str """ @@ -1101,56 +879,22 @@ class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination) 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(HybridConnectionEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'HybridConnection' # type: str self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'HybridConnection' - - -class IdentityInfo(Model): - """The identity information for the resource. - - :param type: The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of - user-assigned identities. The type 'None' will remove any identity. - Possible values include: 'None', 'SystemAssigned', 'UserAssigned', - 'SystemAssigned, UserAssigned' - :type type: str or ~azure.mgmt.eventgrid.models.IdentityType - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param user_assigned_identities: The list of user identities associated - with the resource. The user identity dictionary key references will be ARM - resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - This property is currently not used and reserved for future usage. - :type user_assigned_identities: dict[str, - ~azure.mgmt.eventgrid.models.UserIdentityProperties] - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__(self, **kwargs): - super(IdentityInfo, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.principal_id = kwargs.get('principal_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) -class InboundIpRule(Model): +class InboundIpRule(msrest.serialization.Model): """InboundIpRule. :param ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. :type ip_mask: str - :param action: Action to perform based on the match or no match of the - IpMask. Possible values include: 'Allow' + :param action: Action to perform based on the match or no match of the IpMask. Possible values + include: "Allow". :type action: str or ~azure.mgmt.eventgrid.models.IpActionType """ @@ -1159,25 +903,26 @@ class InboundIpRule(Model): 'action': {'key': 'action', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(InboundIpRule, self).__init__(**kwargs) self.ip_mask = kwargs.get('ip_mask', None) self.action = kwargs.get('action', None) -class InputSchemaMapping(Model): - """By default, Event Grid expects events to be in the Event Grid event schema. - Specifying an input schema mapping enables publishing to Event Grid using a - custom input schema. Currently, the only supported type of - InputSchemaMapping is 'JsonInputSchemaMapping'. +class InputSchemaMapping(msrest.serialization.Model): + """By default, Event Grid expects events to be in the Event Grid event schema. Specifying an input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JsonInputSchemaMapping + sub-classes are: JsonInputSchemaMapping. All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Constant filled by server. - :type input_schema_mapping_type: str + :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType """ _validation = { @@ -1192,19 +937,19 @@ class InputSchemaMapping(Model): 'input_schema_mapping_type': {'Json': 'JsonInputSchemaMapping'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(InputSchemaMapping, self).__init__(**kwargs) - self.input_schema_mapping_type = None + self.input_schema_mapping_type = None # type: Optional[str] -class JsonField(Model): - """This is used to express the source of an input schema mapping for a single - target field in the Event Grid Event schema. This is currently used in the - mappings for the 'id', 'topic' and 'eventtime' properties. This represents - a field in the input event schema. +class JsonField(msrest.serialization.Model): + """This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the input event schema. - :param source_field: Name of a field in the input event schema that's to - be used as the source of a mapping. + :param source_field: Name of a field in the input event schema that's to be used as the source + of a mapping. :type source_field: str """ @@ -1212,27 +957,25 @@ class JsonField(Model): 'source_field': {'key': 'sourceField', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JsonField, self).__init__(**kwargs) self.source_field = kwargs.get('source_field', None) -class JsonFieldWithDefault(Model): - """This is used to express the source of an input schema mapping for a single - target field - in the Event Grid Event schema. This is currently used in the mappings for - the 'subject', - 'eventtype' and 'dataversion' properties. This represents a field in the - input event schema - along with a default value to be used, and at least one of these two - properties should be provided. +class JsonFieldWithDefault(msrest.serialization.Model): + """This is used to express the source of an input schema mapping for a single target field +in the Event Grid Event schema. This is currently used in the mappings for the 'subject', +'eventtype' and 'dataversion' properties. This represents a field in the input event schema +along with a default value to be used, and at least one of these two properties should be provided. - :param source_field: Name of a field in the input event schema that's to - be used as the source of a mapping. + :param source_field: Name of a field in the input event schema that's to be used as the source + of a mapping. :type source_field: str - :param default_value: The default value to be used for mapping when a - SourceField is not provided or if there's no property with the specified - name in the published JSON event payload. + :param default_value: The default value to be used for mapping when a SourceField is not + provided or if there's no property with the specified name in the published JSON event payload. :type default_value: str """ @@ -1241,38 +984,35 @@ class JsonFieldWithDefault(Model): 'default_value': {'key': 'defaultValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JsonFieldWithDefault, self).__init__(**kwargs) self.source_field = kwargs.get('source_field', None) self.default_value = kwargs.get('default_value', None) class JsonInputSchemaMapping(InputSchemaMapping): - """This enables publishing to Event Grid using a custom input schema. This can - be used to map properties from a custom input JSON schema to the Event Grid - event schema. + """This enables publishing to Event Grid using a custom input schema. This can be used to map properties from a custom input JSON schema to the Event Grid event schema. All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Constant filled by server. - :type input_schema_mapping_type: str - :param id: The mapping information for the Id property of the Event Grid - Event. + :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :param id: The mapping information for the Id property of the Event Grid Event. :type id: ~azure.mgmt.eventgrid.models.JsonField - :param topic: The mapping information for the Topic property of the Event - Grid Event. + :param topic: The mapping information for the Topic property of the Event Grid Event. :type topic: ~azure.mgmt.eventgrid.models.JsonField - :param event_time: The mapping information for the EventTime property of - the Event Grid Event. + :param event_time: The mapping information for the EventTime property of the Event Grid Event. :type event_time: ~azure.mgmt.eventgrid.models.JsonField - :param event_type: The mapping information for the EventType property of - the Event Grid Event. + :param event_type: The mapping information for the EventType property of the Event Grid Event. :type event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param subject: The mapping information for the Subject property of the - Event Grid Event. + :param subject: The mapping information for the Subject property of the Event Grid Event. :type subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param data_version: The mapping information for the DataVersion property - of the Event Grid Event. + :param data_version: The mapping information for the DataVersion property of the Event Grid + Event. :type data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault """ @@ -1290,15 +1030,18 @@ class JsonInputSchemaMapping(InputSchemaMapping): 'data_version': {'key': 'properties.dataVersion', 'type': 'JsonFieldWithDefault'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JsonInputSchemaMapping, self).__init__(**kwargs) + self.input_schema_mapping_type = 'Json' # type: str self.id = kwargs.get('id', None) self.topic = kwargs.get('topic', None) self.event_time = kwargs.get('event_time', None) self.event_type = kwargs.get('event_type', None) self.subject = kwargs.get('subject', None) self.data_version = kwargs.get('data_version', None) - self.input_schema_mapping_type = 'Json' class NumberGreaterThanAdvancedFilter(AdvancedFilter): @@ -1306,11 +1049,14 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1320,15 +1066,18 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberGreaterThanAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberGreaterThan' # type: str self.value = kwargs.get('value', None) - self.operator_type = 'NumberGreaterThan' class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): @@ -1336,11 +1085,14 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1350,15 +1102,18 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberGreaterThanOrEqualsAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberGreaterThanOrEquals' # type: str self.value = kwargs.get('value', None) - self.operator_type = 'NumberGreaterThanOrEquals' class NumberInAdvancedFilter(AdvancedFilter): @@ -1366,11 +1121,14 @@ class NumberInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[float] """ @@ -1380,15 +1138,18 @@ class NumberInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[float]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberInAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberIn' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'NumberIn' class NumberLessThanAdvancedFilter(AdvancedFilter): @@ -1396,11 +1157,14 @@ class NumberLessThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1410,15 +1174,18 @@ class NumberLessThanAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberLessThanAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberLessThan' # type: str self.value = kwargs.get('value', None) - self.operator_type = 'NumberLessThan' class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): @@ -1426,11 +1193,14 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1440,15 +1210,18 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberLessThanOrEqualsAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberLessThanOrEquals' # type: str self.value = kwargs.get('value', None) - self.operator_type = 'NumberLessThanOrEquals' class NumberNotInAdvancedFilter(AdvancedFilter): @@ -1456,11 +1229,14 @@ class NumberNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[float] """ @@ -1470,27 +1246,30 @@ class NumberNotInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[float]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NumberNotInAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberNotIn' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'NumberNotIn' -class Operation(Model): +class Operation(msrest.serialization.Model): """Represents an operation returned by the GetOperations request. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param display: Display name of the operation + :param display: Display name of the operation. :type display: ~azure.mgmt.eventgrid.models.OperationInfo - :param origin: Origin of the operation + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation + :param properties: Properties of the operation. :type properties: object """ @@ -1501,7 +1280,10 @@ class Operation(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1509,16 +1291,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class OperationInfo(Model): +class OperationInfo(msrest.serialization.Model): """Information about an operation. - :param provider: Name of the provider + :param provider: Name of the provider. :type provider: str - :param resource: Name of the resource type + :param resource: Name of the resource type. :type resource: str - :param operation: Name of the operation + :param operation: Name of the operation. :type operation: str - :param description: Description of the operation + :param description: Description of the operation. :type description: str """ @@ -1529,7 +1311,10 @@ class OperationInfo(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationInfo, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1537,482 +1322,26 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class PartnerNamespace(TrackedResource): - """EventGrid Partner Namespace. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the partner namespace. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerNamespaceProvisioningState - :param partner_registration_fully_qualified_id: The fully qualified ARM Id - of the partner registration that should be associated with this partner - namespace. This takes the following format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. - :type partner_registration_fully_qualified_id: str - :ivar endpoint: Endpoint for the partner namespace. - :vartype endpoint: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'endpoint': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_registration_fully_qualified_id': {'key': 'properties.partnerRegistrationFullyQualifiedId', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PartnerNamespace, self).__init__(**kwargs) - self.provisioning_state = None - self.partner_registration_fully_qualified_id = kwargs.get('partner_registration_fully_qualified_id', None) - self.endpoint = None - - -class PartnerNamespaceRegenerateKeyRequest(Model): - """PartnerNamespace regenerate shared access key request. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. Key name to regenerate (key1 or key2). - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PartnerNamespaceRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - - -class PartnerNamespaceSharedAccessKeys(Model): - """Shared access keys of the partner namespace. +class OperationsListResult(msrest.serialization.Model): + """Result of the List Operations operation. - :param key1: Shared access key1 for the partner namespace. - :type key1: str - :param key2: Shared access key2 for the partner namespace. - :type key2: str + :param value: A collection of operations. + :type value: list[~azure.mgmt.eventgrid.models.Operation] """ _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, } - def __init__(self, **kwargs): - super(PartnerNamespaceSharedAccessKeys, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class PartnerNamespaceUpdateParameters(Model): - """Properties of the PartnerNamespace update. - - :param tags: Tags of the partner namespace. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(PartnerNamespaceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class PartnerRegistration(TrackedResource): - """Information about a partner registration. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the partner registration. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerRegistrationProvisioningState - :param partner_name: Official name of the partner name. For example: - "Contoso". - :type partner_name: str - :param partner_resource_type_name: Name of the partner resource type. - :type partner_resource_type_name: str - :param partner_resource_type_display_name: Display name of the partner - resource type. - :type partner_resource_type_display_name: str - :param partner_resource_type_description: Short description of the partner - resource type. The length of this description should not exceed 256 - characters. - :type partner_resource_type_description: str - :param long_description: Long description for the custom scenarios and - integration to be displayed in the portal if needed. - Length of this description should not exceed 2048 characters. - :type long_description: str - :param partner_customer_service_number: The customer service number of the - publisher. The expected phone format should start with a '+' sign - followed by the country code. The remaining digits are then followed. Only - digits and spaces are allowed and its - length cannot exceed 16 digits including country code. Examples of valid - phone numbers are: +1 515 123 4567 and - +966 7 5115 2471. Examples of invalid phone numbers are: +1 (515) - 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 - :type partner_customer_service_number: str - :param partner_customer_service_extension: The extension of the customer - service number of the publisher. Only digits are allowed and number of - digits should not exceed 10. - :type partner_customer_service_extension: str - :param customer_service_uri: The extension of the customer service URI of - the publisher. - :type customer_service_uri: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param logo_uri: URI of the logo. - :type logo_uri: str - :param visibility_state: Visibility state of the partner registration. - Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' - :type visibility_state: str or - ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState - :param authorized_azure_subscription_ids: List of Azure subscription Ids - that are authorized to create a partner namespace - associated with this partner registration. This is an optional property. - Creating - partner namespaces is always permitted under the same Azure subscription - as the one used - for creating the partner registration. - :type authorized_azure_subscription_ids: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, - 'partner_resource_type_name': {'key': 'properties.partnerResourceTypeName', 'type': 'str'}, - 'partner_resource_type_display_name': {'key': 'properties.partnerResourceTypeDisplayName', 'type': 'str'}, - 'partner_resource_type_description': {'key': 'properties.partnerResourceTypeDescription', 'type': 'str'}, - 'long_description': {'key': 'properties.longDescription', 'type': 'str'}, - 'partner_customer_service_number': {'key': 'properties.partnerCustomerServiceNumber', 'type': 'str'}, - 'partner_customer_service_extension': {'key': 'properties.partnerCustomerServiceExtension', 'type': 'str'}, - 'customer_service_uri': {'key': 'properties.customerServiceUri', 'type': 'str'}, - 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, - 'logo_uri': {'key': 'properties.logoUri', 'type': 'str'}, - 'visibility_state': {'key': 'properties.visibilityState', 'type': 'str'}, - 'authorized_azure_subscription_ids': {'key': 'properties.authorizedAzureSubscriptionIds', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(PartnerRegistration, self).__init__(**kwargs) - self.provisioning_state = None - self.partner_name = kwargs.get('partner_name', None) - self.partner_resource_type_name = kwargs.get('partner_resource_type_name', None) - self.partner_resource_type_display_name = kwargs.get('partner_resource_type_display_name', None) - self.partner_resource_type_description = kwargs.get('partner_resource_type_description', None) - self.long_description = kwargs.get('long_description', None) - self.partner_customer_service_number = kwargs.get('partner_customer_service_number', None) - self.partner_customer_service_extension = kwargs.get('partner_customer_service_extension', None) - self.customer_service_uri = kwargs.get('customer_service_uri', None) - self.setup_uri = kwargs.get('setup_uri', None) - self.logo_uri = kwargs.get('logo_uri', None) - self.visibility_state = kwargs.get('visibility_state', None) - self.authorized_azure_subscription_ids = kwargs.get('authorized_azure_subscription_ids', None) - - -class PartnerRegistrationEventTypesListResult(Model): - """Result of the List Partner Registration Event Types operation. - - :param value: A collection of partner registration event types. - :type value: list[~azure.mgmt.eventgrid.models.EventType] - :param next_link: A link for the next page of partner registration event - types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EventType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PartnerRegistrationEventTypesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PartnerRegistrationUpdateParameters(Model): - """Properties of the Partner Registration update. - - :param tags: Tags of the partner registration resource. - :type tags: dict[str, str] - :param partner_topic_type_name: Name of the partner topic type. - :type partner_topic_type_name: str - :param partner_topic_type_display_name: Display name of the partner topic - type. - :type partner_topic_type_display_name: str - :param partner_topic_type_description: Description of the partner topic - type. - :type partner_topic_type_description: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param logo_uri: URI of the partner logo. - :type logo_uri: str - :param authorized_azure_subscription_ids: List of IDs of Azure AD - applications that are authorized to create a partner namespace - associated with this partner registration. This is an optional property. - Creating - partner namespaces is always permitted under the same Azure subscription - as the one used - for creating the partner registration. - :type authorized_azure_subscription_ids: list[str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'partner_topic_type_name': {'key': 'partnerTopicTypeName', 'type': 'str'}, - 'partner_topic_type_display_name': {'key': 'partnerTopicTypeDisplayName', 'type': 'str'}, - 'partner_topic_type_description': {'key': 'partnerTopicTypeDescription', 'type': 'str'}, - 'setup_uri': {'key': 'setupUri', 'type': 'str'}, - 'logo_uri': {'key': 'logoUri', 'type': 'str'}, - 'authorized_azure_subscription_ids': {'key': 'authorizedAzureSubscriptionIds', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(PartnerRegistrationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.partner_topic_type_name = kwargs.get('partner_topic_type_name', None) - self.partner_topic_type_display_name = kwargs.get('partner_topic_type_display_name', None) - self.partner_topic_type_description = kwargs.get('partner_topic_type_description', None) - self.setup_uri = kwargs.get('setup_uri', None) - self.logo_uri = kwargs.get('logo_uri', None) - self.authorized_azure_subscription_ids = kwargs.get('authorized_azure_subscription_ids', None) - - -class PartnerTopic(TrackedResource): - """EventGrid Partner Topic. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :param source: Source associated with this partner topic. This represents - a unique partner resource. - :type source: str - :param expiration_time_if_not_activated_utc: Expiration time of the - partner topic. If this timer expires while the partner topic is still - never activated, - the partner topic and corresponding event channel are deleted. - :type expiration_time_if_not_activated_utc: datetime - :ivar provisioning_state: Provisioning state of the partner topic. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicProvisioningState - :param activation_state: Activation state of the partner topic. Possible - values include: 'NeverActivated', 'Activated', 'Deactivated' - :type activation_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicActivationState - :param partner_topic_friendly_description: Friendly description about the - topic. This can be set by the publisher/partner to show custom description - for the customer partner topic. - This will be helpful to remove any ambiguity of the origin of creation of - the partner topic for the customer. - :type partner_topic_friendly_description: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'activation_state': {'key': 'properties.activationState', 'type': 'str'}, - 'partner_topic_friendly_description': {'key': 'properties.partnerTopicFriendlyDescription', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PartnerTopic, self).__init__(**kwargs) - self.source = kwargs.get('source', None) - self.expiration_time_if_not_activated_utc = kwargs.get('expiration_time_if_not_activated_utc', None) - self.provisioning_state = None - self.activation_state = kwargs.get('activation_state', None) - self.partner_topic_friendly_description = kwargs.get('partner_topic_friendly_description', None) - - -class PartnerTopicType(Resource): - """Properties of a partner topic type. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param partner_name: Official name of the partner. - :type partner_name: str - :param topic_type_name: Name of the partner topic type. This name should - be unique among all partner topic types names. - :type topic_type_name: str - :param display_name: Display Name for the partner topic type. - :type display_name: str - :param description: Description of the partner topic type. - :type description: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param authorization_state: Status of whether the customer has authorized - a partner to create partner topics - in the customer's subscription. Possible values include: 'NotApplicable', - 'NotAuthorized', 'Authorized' - :type authorization_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicTypeAuthorizationState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, - 'topic_type_name': {'key': 'properties.topicTypeName', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, - 'authorization_state': {'key': 'properties.authorizationState', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PartnerTopicType, self).__init__(**kwargs) - self.partner_name = kwargs.get('partner_name', None) - self.topic_type_name = kwargs.get('topic_type_name', None) - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.setup_uri = kwargs.get('setup_uri', None) - self.authorization_state = kwargs.get('authorization_state', None) - - -class PartnerTopicTypesListResult(Model): - """Result of the List Partner Topic Types operation. - - :param value: A collection of partner topic types. - :type value: list[~azure.mgmt.eventgrid.models.PartnerTopicType] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PartnerTopicType]'}, - } - - def __init__(self, **kwargs): - super(PartnerTopicTypesListResult, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(OperationsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class PartnerTopicUpdateParameters(Model): - """Properties of the Partner Topic update. - - :param tags: Tags of the partner topic. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(PartnerTopicUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """PrivateEndpoint information. :param id: The ARM identifier for Private Endpoint. @@ -2023,7 +1352,10 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -2031,29 +1363,23 @@ def __init__(self, **kwargs): class PrivateEndpointConnection(Resource): """PrivateEndpointConnection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str - :param private_endpoint: The Private Endpoint resource for this - Connection. + :param private_endpoint: The Private Endpoint resource for this Connection. :type private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint :param group_ids: GroupIds from the private link service resource. :type group_ids: list[str] - :param private_link_service_connection_state: Details about the state of - the connection. - :type private_link_service_connection_state: - ~azure.mgmt.eventgrid.models.ConnectionState - :param provisioning_state: Provisioning state of the Private Endpoint - Connection. Possible values include: 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState """ _validation = { @@ -2072,7 +1398,10 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.group_ids = kwargs.get('group_ids', None) @@ -2080,9 +1409,38 @@ def __init__(self, **kwargs): self.provisioning_state = kwargs.get('provisioning_state', None) -class PrivateLinkResource(Model): +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(msrest.serialization.Model): """Information of the private link resource. + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str :param group_id: :type group_id: str :param display_name: @@ -2091,60 +1449,61 @@ class PrivateLinkResource(Model): :type required_members: list[str] :param required_zone_names: :type required_zone_names: list[str] - :param id: Fully qualified identifier of the resource. - :type id: str - :param name: Name of the resource - :type name: str - :param type: Type of the resource - :type type: str """ _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) self.group_id = kwargs.get('group_id', None) self.display_name = kwargs.get('display_name', None) self.required_members = kwargs.get('required_members', None) self.required_zone_names = kwargs.get('required_zone_names', None) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) -class ResourceSku(Model): - """Describes an EventGrid Resource Sku. +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. - :param name: The Sku name of the resource. The possible values are: Basic - or Premium. Possible values include: 'Basic', 'Premium' - :type name: str or ~azure.mgmt.eventgrid.models.Sku + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ResourceSku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class RetryPolicy(Model): +class RetryPolicy(msrest.serialization.Model): """Information about the retry policy for an event subscription. - :param max_delivery_attempts: Maximum number of delivery retry attempts - for events. + :param max_delivery_attempts: Maximum number of delivery retry attempts for events. :type max_delivery_attempts: int - :param event_time_to_live_in_minutes: Time To Live (in minutes) for - events. + :param event_time_to_live_in_minutes: Time To Live (in minutes) for events. :type event_time_to_live_in_minutes: int """ @@ -2153,7 +1512,10 @@ class RetryPolicy(Model): 'event_time_to_live_in_minutes': {'key': 'eventTimeToLiveInMinutes', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RetryPolicy, self).__init__(**kwargs) self.max_delivery_attempts = kwargs.get('max_delivery_attempts', None) self.event_time_to_live_in_minutes = kwargs.get('event_time_to_live_in_minutes', None) @@ -2164,10 +1526,12 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + destination of an event subscription. :type resource_id: str """ @@ -2180,22 +1544,26 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'ServiceBusQueue' # type: str self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'ServiceBusQueue' class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus topic destination for an event - subscription. + """Information about the service bus topic destination for an event subscription. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus Topic destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic + destination of an event subscription. :type resource_id: str """ @@ -2208,10 +1576,13 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'ServiceBusTopic' # type: str self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'ServiceBusTopic' class StorageBlobDeadLetterDestination(DeadLetterDestination): @@ -2219,13 +1590,14 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that is - the destination of the deadletter events + :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType + :param resource_id: The Azure Resource ID of the storage account that is the destination of the + deadletter events. :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is - the destination of the deadletter events + :param blob_container_name: The name of the Storage blob container that is the destination of + the deadletter events. :type blob_container_name: str """ @@ -2239,11 +1611,14 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): 'blob_container_name': {'key': 'properties.blobContainerName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) + self.endpoint_type = 'StorageBlob' # type: str self.resource_id = kwargs.get('resource_id', None) self.blob_container_name = kwargs.get('blob_container_name', None) - self.endpoint_type = 'StorageBlob' class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): @@ -2251,13 +1626,15 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that - contains the queue that is the destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource ID of the storage account that contains the queue that + is the destination of an event subscription. :type resource_id: str - :param queue_name: The name of the Storage queue under a storage account - that is the destination of an event subscription. + :param queue_name: The name of the Storage queue under a storage account that is the + destination of an event subscription. :type queue_name: str """ @@ -2271,11 +1648,14 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): 'queue_name': {'key': 'properties.queueName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'StorageQueue' # type: str self.resource_id = kwargs.get('resource_id', None) self.queue_name = kwargs.get('queue_name', None) - self.endpoint_type = 'StorageQueue' class StringBeginsWithAdvancedFilter(AdvancedFilter): @@ -2283,11 +1663,14 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2297,15 +1680,18 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringBeginsWithAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringBeginsWith' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'StringBeginsWith' class StringContainsAdvancedFilter(AdvancedFilter): @@ -2313,11 +1699,14 @@ class StringContainsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2327,15 +1716,18 @@ class StringContainsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringContainsAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringContains' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'StringContains' class StringEndsWithAdvancedFilter(AdvancedFilter): @@ -2343,11 +1735,14 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2357,15 +1752,18 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringEndsWithAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringEndsWith' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'StringEndsWith' class StringInAdvancedFilter(AdvancedFilter): @@ -2373,11 +1771,14 @@ class StringInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2387,15 +1788,18 @@ class StringInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringInAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringIn' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'StringIn' class StringNotInAdvancedFilter(AdvancedFilter): @@ -2403,11 +1807,14 @@ class StringNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2417,149 +1824,64 @@ class StringNotInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StringNotInAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringNotIn' # type: str self.values = kwargs.get('values', None) - self.operator_type = 'StringNotIn' - - -class SystemTopic(TrackedResource): - """EventGrid System Topic. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the system topic. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.ResourceProvisioningState - :param source: Source for the system topic. - :type source: str - :param topic_type: TopicType for the system topic. - :type topic_type: str - :ivar metric_resource_id: Metric resource id for the system topic. - :vartype metric_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'metric_resource_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'topic_type': {'key': 'properties.topicType', 'type': 'str'}, - 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SystemTopic, self).__init__(**kwargs) - self.provisioning_state = None - self.source = kwargs.get('source', None) - self.topic_type = kwargs.get('topic_type', None) - self.metric_resource_id = None - - -class SystemTopicUpdateParameters(Model): - """Properties of the System Topic update. - - :param tags: Tags of the system topic. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(SystemTopicUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) class Topic(TrackedResource): """EventGrid Topic. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] :param private_endpoint_connections: :type private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar provisioning_state: Provisioning state of the topic. Possible values - include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', - 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.TopicProvisioningState + :ivar provisioning_state: Provisioning state of the topic. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicProvisioningState :ivar endpoint: Endpoint for the topic. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should - expect for incoming events published to the topic. Possible values - include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventSchemaV1_0'. - Default value: "EventGridSchema" . + :param input_schema: This determines the format that Event Grid should expect for incoming + events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", + "CloudEventSchemaV1_0". :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: This enables publishing using custom event - schemas. An InputSchemaMapping can be specified to map various properties - of a source schema to various required properties of the EventGridEvent - schema. - :type input_schema_mapping: - ~azure.mgmt.eventgrid.models.InputSchemaMapping + :param input_schema_mapping: This enables publishing using custom event schemas. An + InputSchemaMapping can be specified to map various properties of a source schema to various + required properties of the EventGridEvent schema. + :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the topic. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -2586,30 +1908,29 @@ class Topic(TrackedResource): 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Topic, self).__init__(**kwargs) self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) self.provisioning_state = None self.endpoint = None - self.input_schema = kwargs.get('input_schema', "EventGridSchema") + self.input_schema = kwargs.get('input_schema', None) self.input_schema_mapping = kwargs.get('input_schema_mapping', None) self.metric_resource_id = None self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) -class TopicRegenerateKeyRequest(Model): +class TopicRegenerateKeyRequest(msrest.serialization.Model): """Topic regenerate share access key request. All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2 + :param key_name: Required. Key name to regenerate key1 or key2. :type key_name: str """ @@ -2621,12 +1942,15 @@ class TopicRegenerateKeyRequest(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopicRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) + self.key_name = kwargs['key_name'] -class TopicSharedAccessKeys(Model): +class TopicSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Topic. :param key1: Shared access key1 for the topic. @@ -2640,23 +1964,48 @@ class TopicSharedAccessKeys(Model): 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopicSharedAccessKeys, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) +class TopicsListResult(msrest.serialization.Model): + """Result of the List Topics operation. + + :param value: A collection of Topics. + :type value: list[~azure.mgmt.eventgrid.models.Topic] + :param next_link: A link for the next page of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Topic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class TopicTypeInfo(Resource): """Properties of a topic type info. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param provider: Namespace of the provider of the topic type. :type provider: str @@ -2664,17 +2013,13 @@ class TopicTypeInfo(Resource): :type display_name: str :param description: Description of the topic type. :type description: str - :param resource_region_type: Region type of the resource. Possible values - include: 'RegionalResource', 'GlobalResource' - :type resource_region_type: str or - ~azure.mgmt.eventgrid.models.ResourceRegionType - :param provisioning_state: Provisioning state of the topic type. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :param supported_locations: List of locations supported by this topic - type. + :param resource_region_type: Region type of the resource. Possible values include: + "RegionalResource", "GlobalResource". + :type resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :param provisioning_state: Provisioning state of the topic type. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :param supported_locations: List of locations supported by this topic type. :type supported_locations: list[str] :param source_resource_format: Source resource format. :type source_resource_format: str @@ -2699,7 +2044,10 @@ class TopicTypeInfo(Resource): 'source_resource_format': {'key': 'properties.sourceResourceFormat', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopicTypeInfo, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.display_name = kwargs.get('display_name', None) @@ -2710,93 +2058,83 @@ def __init__(self, **kwargs): self.source_resource_format = kwargs.get('source_resource_format', None) -class TopicUpdateParameters(Model): +class TopicTypesListResult(msrest.serialization.Model): + """Result of the List Topic Types operation. + + :param value: A collection of topic types. + :type value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicTypeInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicTypesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class TopicUpdateParameters(msrest.serialization.Model): """Properties of the Topic update. - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] - :param identity: Resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the topic. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) - self.sku = kwargs.get('sku', None) - - -class UserIdentityProperties(Model): - """The information about the user identity. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) class WebHookEventSubscriptionDestination(EventSubscriptionDestination): """Information about the webhook destination for an event subscription. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param endpoint_url: The URL that represents the endpoint of the - destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. :type endpoint_url: str - :ivar endpoint_base_url: The base URL that represents the endpoint of the - destination of an event subscription. + :ivar endpoint_base_url: The base URL that represents the endpoint of the destination of an + event subscription. :vartype endpoint_base_url: str :param max_events_per_batch: Maximum number of events per batch. :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in - Kilobytes. + :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. :type preferred_batch_size_in_kilobytes: int - :param azure_active_directory_tenant_id: The Azure Active Directory Tenant - ID to get the access token that will be included as the bearer token in - delivery requests. + :param azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access + token that will be included as the bearer token in delivery requests. :type azure_active_directory_tenant_id: str - :param azure_active_directory_application_id_or_uri: The Azure Active - Directory Application ID or URI to get the access token that will be - included as the bearer token in delivery requests. + :param azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID + or URI to get the access token that will be included as the bearer token in delivery requests. :type azure_active_directory_application_id_or_uri: str """ @@ -2815,12 +2153,15 @@ class WebHookEventSubscriptionDestination(EventSubscriptionDestination): 'azure_active_directory_application_id_or_uri': {'key': 'properties.azureActiveDirectoryApplicationIdOrUri', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WebHookEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'WebHook' # type: str self.endpoint_url = kwargs.get('endpoint_url', None) self.endpoint_base_url = None self.max_events_per_batch = kwargs.get('max_events_per_batch', None) self.preferred_batch_size_in_kilobytes = kwargs.get('preferred_batch_size_in_kilobytes', None) self.azure_active_directory_tenant_id = kwargs.get('azure_active_directory_tenant_id', None) self.azure_active_directory_application_id_or_uri = kwargs.get('azure_active_directory_application_id_or_uri', None) - self.endpoint_type = 'WebHook' diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py index 202b84a676aa..657d5ae64ca9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py @@ -1,41 +1,35 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import datetime +from typing import Dict, List, Optional, Union +import msrest.serialization -class AdvancedFilter(Model): - """This is the base type that represents an advanced filter. To configure an - advanced filter, do not directly instantiate an object of this class. - Instead, instantiate an object of a derived class such as - BoolEqualsAdvancedFilter, NumberInAdvancedFilter, - StringEqualsAdvancedFilter etc. depending on the type of the key based on - which you want to filter. +from ._event_grid_management_client_enums import * + + +class AdvancedFilter(msrest.serialization.Model): + """This is the base type that represents an advanced filter. To configure an advanced filter, do not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key based on which you want to filter. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: NumberInAdvancedFilter, NumberNotInAdvancedFilter, - NumberLessThanAdvancedFilter, NumberGreaterThanAdvancedFilter, - NumberLessThanOrEqualsAdvancedFilter, - NumberGreaterThanOrEqualsAdvancedFilter, BoolEqualsAdvancedFilter, - StringInAdvancedFilter, StringNotInAdvancedFilter, - StringBeginsWithAdvancedFilter, StringEndsWithAdvancedFilter, - StringContainsAdvancedFilter + sub-classes are: BoolEqualsAdvancedFilter, NumberGreaterThanAdvancedFilter, NumberGreaterThanOrEqualsAdvancedFilter, NumberInAdvancedFilter, NumberLessThanAdvancedFilter, NumberLessThanOrEqualsAdvancedFilter, NumberNotInAdvancedFilter, StringBeginsWithAdvancedFilter, StringContainsAdvancedFilter, StringEndsWithAdvancedFilter, StringInAdvancedFilter, StringNotInAdvancedFilter. All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str """ _validation = { @@ -43,36 +37,37 @@ class AdvancedFilter(Model): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, } _subtype_map = { - 'operator_type': {'NumberIn': 'NumberInAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'BoolEquals': 'BoolEqualsAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter'} + 'operator_type': {'BoolEquals': 'BoolEqualsAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberIn': 'NumberInAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter'} } - def __init__(self, *, key: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + **kwargs + ): super(AdvancedFilter, self).__init__(**kwargs) + self.operator_type = None # type: Optional[str] self.key = key - self.operator_type = None -class EventSubscriptionDestination(Model): +class EventSubscriptionDestination(msrest.serialization.Model): """Information about the destination for an event subscription. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: WebHookEventSubscriptionDestination, - EventHubEventSubscriptionDestination, - StorageQueueEventSubscriptionDestination, - HybridConnectionEventSubscriptionDestination, - ServiceBusQueueEventSubscriptionDestination, - ServiceBusTopicEventSubscriptionDestination, - AzureFunctionEventSubscriptionDestination + sub-classes are: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType """ _validation = { @@ -84,12 +79,15 @@ class EventSubscriptionDestination(Model): } _subtype_map = { - 'endpoint_type': {'WebHook': 'WebHookEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'AzureFunction': 'AzureFunctionEventSubscriptionDestination'} + 'endpoint_type': {'AzureFunction': 'AzureFunctionEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'WebHook': 'WebHookEventSubscriptionDestination'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(EventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = None + self.endpoint_type = None # type: Optional[str] class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): @@ -97,15 +95,16 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Azure Function destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Azure Function + destination of an event subscription. :type resource_id: str :param max_events_per_batch: Maximum number of events per batch. :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in - Kilobytes. + :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. :type preferred_batch_size_in_kilobytes: int """ @@ -120,12 +119,19 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): 'preferred_batch_size_in_kilobytes': {'key': 'properties.preferredBatchSizeInKilobytes', 'type': 'int'}, } - def __init__(self, *, resource_id: str=None, max_events_per_batch: int=None, preferred_batch_size_in_kilobytes: int=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + max_events_per_batch: Optional[int] = None, + preferred_batch_size_in_kilobytes: Optional[int] = None, + **kwargs + ): super(AzureFunctionEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'AzureFunction' # type: str self.resource_id = resource_id self.max_events_per_batch = max_events_per_batch self.preferred_batch_size_in_kilobytes = preferred_batch_size_in_kilobytes - self.endpoint_type = 'AzureFunction' class BoolEqualsAdvancedFilter(AdvancedFilter): @@ -133,11 +139,14 @@ class BoolEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The boolean filter value. :type value: bool """ @@ -147,32 +156,29 @@ class BoolEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, *, key: str=None, value: bool=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[bool] = None, + **kwargs + ): super(BoolEqualsAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'BoolEquals' # type: str self.value = value - self.operator_type = 'BoolEquals' - -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - -class ConnectionState(Model): +class ConnectionState(msrest.serialization.Model): """ConnectionState information. - :param status: Status of the connection. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' - :type status: str or - ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus :param description: Description of the connection state. :type description: str :param actions_required: Actions required (if any). @@ -185,27 +191,31 @@ class ConnectionState(Model): 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, *, status=None, description: str=None, actions_required: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "PersistedConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): super(ConnectionState, self).__init__(**kwargs) self.status = status self.description = description self.actions_required = actions_required -class DeadLetterDestination(Model): - """Information about the dead letter destination for an event subscription. To - configure a deadletter destination, do not directly instantiate an object - of this class. Instead, instantiate an object of a derived class. - Currently, StorageBlobDeadLetterDestination is the only class that derives - from this class. +class DeadLetterDestination(msrest.serialization.Model): + """Information about the dead letter destination for an event subscription. To configure a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StorageBlobDeadLetterDestination + sub-classes are: StorageBlobDeadLetterDestination. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str + :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType """ _validation = { @@ -220,72 +230,24 @@ class DeadLetterDestination(Model): 'endpoint_type': {'StorageBlob': 'StorageBlobDeadLetterDestination'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeadLetterDestination, self).__init__(**kwargs) - self.endpoint_type = None - - -class DeadLetterWithResourceIdentity(Model): - """Information about the deadletter destination with resource identity. - - :param identity: The identity to use when dead-lettering events. - :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :param dead_letter_destination: Information about the destination where - events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, - 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, - } - - def __init__(self, *, identity=None, dead_letter_destination=None, **kwargs) -> None: - super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) - self.identity = identity - self.dead_letter_destination = dead_letter_destination - - -class DeliveryWithResourceIdentity(Model): - """Information about the delivery for an event subscription with resource - identity. - - :param identity: The identity to use when delivering events. - :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, - 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, - } - - def __init__(self, *, identity=None, destination=None, **kwargs) -> None: - super(DeliveryWithResourceIdentity, self).__init__(**kwargs) - self.identity = identity - self.destination = destination + self.endpoint_type = None # type: Optional[str] -class Resource(Model): +class Resource(msrest.serialization.Model): """Definition of a Resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str """ @@ -301,7 +263,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -311,20 +276,19 @@ def __init__(self, **kwargs) -> None: class TrackedResource(Resource): """Definition of a Tracked Resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] """ @@ -343,7 +307,13 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -352,57 +322,46 @@ def __init__(self, *, location: str, tags=None, **kwargs) -> None: class Domain(TrackedResource): """EventGrid Domain. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] :param private_endpoint_connections: List of private endpoint connections. :type private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar provisioning_state: Provisioning state of the domain. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.DomainProvisioningState + :ivar provisioning_state: Provisioning state of the domain. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainProvisioningState :ivar endpoint: Endpoint for the domain. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should - expect for incoming events published to the domain. Possible values - include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventSchemaV1_0'. - Default value: "EventGridSchema" . + :param input_schema: This determines the format that Event Grid should expect for incoming + events published to the domain. Possible values include: "EventGridSchema", + "CustomEventSchema", "CloudEventSchemaV1_0". :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: Information about the InputSchemaMapping - which specified the info about mapping event payload. - :type input_schema_mapping: - ~azure.mgmt.eventgrid.models.InputSchemaMapping + :param input_schema_mapping: Information about the InputSchemaMapping which specified the info + about mapping event payload. + :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the domain. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the domain. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -429,11 +388,20 @@ class Domain(TrackedResource): 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, *, location: str, tags=None, private_endpoint_connections=None, input_schema="EventGridSchema", input_schema_mapping=None, public_network_access=None, inbound_ip_rules=None, sku=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + input_schema: Optional[Union[str, "InputSchema"]] = None, + input_schema_mapping: Optional["InputSchemaMapping"] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + **kwargs + ): super(Domain, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = private_endpoint_connections self.provisioning_state = None @@ -443,11 +411,9 @@ def __init__(self, *, location: str, tags=None, private_endpoint_connections=Non self.metric_resource_id = None self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules - self.sku = sku - self.identity = identity -class DomainRegenerateKeyRequest(Model): +class DomainRegenerateKeyRequest(msrest.serialization.Model): """Domain regenerate share access key request. All required parameters must be populated in order to send to Azure. @@ -464,12 +430,17 @@ class DomainRegenerateKeyRequest(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, key_name: str, **kwargs) -> None: + def __init__( + self, + *, + key_name: str, + **kwargs + ): super(DomainRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = key_name -class DomainSharedAccessKeys(Model): +class DomainSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Domain. :param key1: Shared access key1 for the domain. @@ -483,227 +454,143 @@ class DomainSharedAccessKeys(Model): 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, *, key1: str=None, key2: str=None, **kwargs) -> None: + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): super(DomainSharedAccessKeys, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 -class DomainTopic(Resource): - """Domain Topic. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param provisioning_state: Provisioning state of the domain topic. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.DomainTopicProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__(self, *, provisioning_state=None, **kwargs) -> None: - super(DomainTopic, self).__init__(**kwargs) - self.provisioning_state = provisioning_state - - -class DomainUpdateParameters(Model): - """Properties of the Domain update. +class DomainsListResult(msrest.serialization.Model): + """Result of the List Domains operation. - :param tags: Tags of the domains resource. - :type tags: dict[str, str] - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param sku: The Sku pricing tier for the domain. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param value: A collection of Domains. + :type value: list[~azure.mgmt.eventgrid.models.Domain] + :param next_link: A link for the next page of domains. + :type next_link: str """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'value': {'key': 'value', 'type': '[Domain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, tags=None, public_network_access=None, inbound_ip_rules=None, identity=None, sku=None, **kwargs) -> None: - super(DomainUpdateParameters, self).__init__(**kwargs) - self.tags = tags - self.public_network_access = public_network_access - self.inbound_ip_rules = inbound_ip_rules - self.identity = identity - self.sku = sku + def __init__( + self, + *, + value: Optional[List["Domain"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DomainsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class EventChannel(Resource): - """Event Channel. +class DomainTopic(Resource): + """Domain Topic. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str - :param source: Source of the event channel. This represents a unique - resource in the partner's resource model. - :type source: ~azure.mgmt.eventgrid.models.EventChannelSource - :param destination: Represents the destination of an event channel. - :type destination: ~azure.mgmt.eventgrid.models.EventChannelDestination - :ivar provisioning_state: Provisioning state of the event channel. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.EventChannelProvisioningState - :ivar partner_topic_readiness_state: The readiness state of the - corresponding partner topic. Possible values include: - 'NotActivatedByUserYet', 'ActivatedByUser', 'DeactivatedByUser', - 'DeletedByUser' - :vartype partner_topic_readiness_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicReadinessState - :param expiration_time_if_not_activated_utc: Expiration time of the event - channel. If this timer expires while the corresponding partner topic is - never activated, - the event channel and corresponding partner topic are deleted. - :type expiration_time_if_not_activated_utc: datetime - :param filter: Information about the filter for the event channel. - :type filter: ~azure.mgmt.eventgrid.models.EventChannelFilter - :param partner_topic_friendly_description: Friendly description about the - topic. This can be set by the publisher/partner to show custom description - for the customer partner topic. - This will be helpful to remove any ambiguity of the origin of creation of - the partner topic for the customer. - :type partner_topic_friendly_description: str + :param provisioning_state: Provisioning state of the domain topic. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainTopicProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'partner_topic_readiness_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'EventChannelSource'}, - 'destination': {'key': 'properties.destination', 'type': 'EventChannelDestination'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_topic_readiness_state': {'key': 'properties.partnerTopicReadinessState', 'type': 'str'}, - 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, - 'filter': {'key': 'properties.filter', 'type': 'EventChannelFilter'}, - 'partner_topic_friendly_description': {'key': 'properties.partnerTopicFriendlyDescription', 'type': 'str'}, } - def __init__(self, *, source=None, destination=None, expiration_time_if_not_activated_utc=None, filter=None, partner_topic_friendly_description: str=None, **kwargs) -> None: - super(EventChannel, self).__init__(**kwargs) - self.source = source - self.destination = destination - self.provisioning_state = None - self.partner_topic_readiness_state = None - self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc - self.filter = filter - self.partner_topic_friendly_description = partner_topic_friendly_description - - -class EventChannelDestination(Model): - """Properties of the destination of an event channel. - - :param azure_subscription_id: Azure subscription ID of the customer - creating the event channel. The partner topic - associated with the event channel will be created under this Azure - subscription. - :type azure_subscription_id: str - :param resource_group: Azure Resource Group of the customer creating the - event channel. The partner topic - associated with the event channel will be created under this resource - group. - :type resource_group: str - :param partner_topic_name: Name of the partner topic associated with the - event channel. - :type partner_topic_name: str - """ - - _attribute_map = { - 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'partner_topic_name': {'key': 'partnerTopicName', 'type': 'str'}, - } - - def __init__(self, *, azure_subscription_id: str=None, resource_group: str=None, partner_topic_name: str=None, **kwargs) -> None: - super(EventChannelDestination, self).__init__(**kwargs) - self.azure_subscription_id = azure_subscription_id - self.resource_group = resource_group - self.partner_topic_name = partner_topic_name + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "DomainTopicProvisioningState"]] = None, + **kwargs + ): + super(DomainTopic, self).__init__(**kwargs) + self.provisioning_state = provisioning_state -class EventChannelFilter(Model): - """Filter for the Event Channel. +class DomainTopicsListResult(msrest.serialization.Model): + """Result of the List Domain Topics operation. - :param advanced_filters: An array of advanced filters that are used for - filtering event channels. - :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + :param value: A collection of Domain Topics. + :type value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :param next_link: A link for the next page of domain topics. + :type next_link: str """ _attribute_map = { - 'advanced_filters': {'key': 'advancedFilters', 'type': '[AdvancedFilter]'}, + 'value': {'key': 'value', 'type': '[DomainTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, advanced_filters=None, **kwargs) -> None: - super(EventChannelFilter, self).__init__(**kwargs) - self.advanced_filters = advanced_filters + def __init__( + self, + *, + value: Optional[List["DomainTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DomainTopicsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class EventChannelSource(Model): - """Properties of the source of an event channel. +class DomainUpdateParameters(msrest.serialization.Model): + """Properties of the Domain update. - :param source: The identifier of the resource that's the source of the - events. - This represents a unique resource in the partner's resource model. - :type source: str + :param tags: A set of tags. Tags of the domains resource. + :type tags: dict[str, str] + :param public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] """ _attribute_map = { - 'source': {'key': 'source', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, } - def __init__(self, *, source: str=None, **kwargs) -> None: - super(EventChannelSource, self).__init__(**kwargs) - self.source = source + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + **kwargs + ): + super(DomainUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.public_network_access = public_network_access + self.inbound_ip_rules = inbound_ip_rules class EventHubEventSubscriptionDestination(EventSubscriptionDestination): @@ -711,10 +598,12 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - an Event Hub destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + destination of an event subscription. :type resource_id: str """ @@ -727,73 +616,52 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + **kwargs + ): super(EventHubEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'EventHub' # type: str self.resource_id = resource_id - self.endpoint_type = 'EventHub' class EventSubscription(Resource): """Event Subscription. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :ivar topic: Name of the topic of the event subscription. :vartype topic: str - :ivar provisioning_state: Provisioning state of the event subscription. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed', 'AwaitingManualAction' + :ivar provisioning_state: Provisioning state of the event subscription. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", + "AwaitingManualAction". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination - where events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :param destination: Information about the destination where events have to be delivered for the + event subscription. + :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. :type labels: list[str] :param expiration_time_utc: Expiration time of the event subscription. - :type expiration_time_utc: datetime - :param event_delivery_schema: The event delivery schema for the event - subscription. Possible values include: 'EventGridSchema', - 'CustomInputSchema', 'CloudEventSchemaV1_0' - :type event_delivery_schema: str or - ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to - configure maximum number of delivery attempts and time to live for events. + :type expiration_time_utc: ~datetime.datetime + :param event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :param retry_policy: The retry policy for events. This can be used to configure maximum number + of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The dead letter destination of the event - subscription. Any event that cannot be delivered to its' destination is - sent to the dead letter destination. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of - the event subscription. Any event that cannot be delivered to its' - destination is sent to the dead letter destination. - Uses the managed identity setup on the parent resource (namely, topic or - domain) to acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + :param dead_letter_destination: The DeadLetter destination of the event subscription. + :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination """ _validation = { @@ -811,53 +679,60 @@ class EventSubscription(Resource): 'topic': {'key': 'properties.topic', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'destination': {'key': 'properties.destination', 'type': 'EventSubscriptionDestination'}, - 'delivery_with_resource_identity': {'key': 'properties.deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'properties.filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'properties.labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'properties.expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'properties.eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'properties.retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'properties.deadLetterDestination', 'type': 'DeadLetterDestination'}, - 'dead_letter_with_resource_identity': {'key': 'properties.deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, *, destination=None, delivery_with_resource_identity=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, dead_letter_with_resource_identity=None, **kwargs) -> None: + def __init__( + self, + *, + destination: Optional["EventSubscriptionDestination"] = None, + filter: Optional["EventSubscriptionFilter"] = None, + labels: Optional[List[str]] = None, + expiration_time_utc: Optional[datetime.datetime] = None, + event_delivery_schema: Optional[Union[str, "EventDeliverySchema"]] = None, + retry_policy: Optional["RetryPolicy"] = None, + dead_letter_destination: Optional["DeadLetterDestination"] = None, + **kwargs + ): super(EventSubscription, self).__init__(**kwargs) self.topic = None self.provisioning_state = None self.destination = destination - self.delivery_with_resource_identity = delivery_with_resource_identity self.filter = filter self.labels = labels self.expiration_time_utc = expiration_time_utc self.event_delivery_schema = event_delivery_schema self.retry_policy = retry_policy self.dead_letter_destination = dead_letter_destination - self.dead_letter_with_resource_identity = dead_letter_with_resource_identity -class EventSubscriptionFilter(Model): +class EventSubscriptionFilter(msrest.serialization.Model): """Filter for the Event Subscription. - :param subject_begins_with: An optional string to filter events for an - event subscription based on a resource path prefix. + :param subject_begins_with: An optional string to filter events for an event subscription based + on a resource path prefix. The format of this depends on the publisher of the events. Wildcard characters are not supported in this path. :type subject_begins_with: str - :param subject_ends_with: An optional string to filter events for an event - subscription based on a resource path suffix. + :param subject_ends_with: An optional string to filter events for an event subscription based + on a resource path suffix. Wildcard characters are not supported in this path. :type subject_ends_with: str - :param included_event_types: A list of applicable event types that need to - be part of the event subscription. If it is desired to subscribe to all - default event types, set the IncludedEventTypes to null. + :param included_event_types: A list of applicable event types that need to be part of the event + subscription. If it is desired to subscribe to all default event types, set the + IncludedEventTypes to null. :type included_event_types: list[str] - :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and - SubjectEndsWith properties of the filter - should be compared in a case sensitive manner. Default value: False . + :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + properties of the filter + should be compared in a case sensitive manner. :type is_subject_case_sensitive: bool - :param advanced_filters: An array of advanced filters that are used for - filtering event subscriptions. + :param advanced_filters: An array of advanced filters that are used for filtering event + subscriptions. :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] """ @@ -869,7 +744,16 @@ class EventSubscriptionFilter(Model): 'advanced_filters': {'key': 'advancedFilters', 'type': '[AdvancedFilter]'}, } - def __init__(self, *, subject_begins_with: str=None, subject_ends_with: str=None, included_event_types=None, is_subject_case_sensitive: bool=False, advanced_filters=None, **kwargs) -> None: + def __init__( + self, + *, + subject_begins_with: Optional[str] = None, + subject_ends_with: Optional[str] = None, + included_event_types: Optional[List[str]] = None, + is_subject_case_sensitive: Optional[bool] = False, + advanced_filters: Optional[List["AdvancedFilter"]] = None, + **kwargs + ): super(EventSubscriptionFilter, self).__init__(**kwargs) self.subject_begins_with = subject_begins_with self.subject_ends_with = subject_ends_with @@ -878,11 +762,11 @@ def __init__(self, *, subject_begins_with: str=None, subject_ends_with: str=None self.advanced_filters = advanced_filters -class EventSubscriptionFullUrl(Model): +class EventSubscriptionFullUrl(msrest.serialization.Model): """Full endpoint url of an event subscription. - :param endpoint_url: The URL that represents the endpoint of the - destination of an event subscription. + :param endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. :type endpoint_url: str """ @@ -890,120 +774,106 @@ class EventSubscriptionFullUrl(Model): 'endpoint_url': {'key': 'endpointUrl', 'type': 'str'}, } - def __init__(self, *, endpoint_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + endpoint_url: Optional[str] = None, + **kwargs + ): super(EventSubscriptionFullUrl, self).__init__(**kwargs) self.endpoint_url = endpoint_url -class EventSubscriptionIdentity(Model): - """The identity information with the event subscription. +class EventSubscriptionsListResult(msrest.serialization.Model): + """Result of the List EventSubscriptions operation. - :param type: The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of - user-assigned identities. The type 'None' will remove any identity. - Possible values include: 'SystemAssigned', 'UserAssigned' - :type type: str or - ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType - :param user_assigned_identity: The user identity associated with the - resource. - :type user_assigned_identity: str + :param value: A collection of EventSubscriptions. + :type value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :param next_link: A link for the next page of event subscriptions. + :type next_link: str """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EventSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, type=None, user_assigned_identity: str=None, **kwargs) -> None: - super(EventSubscriptionIdentity, self).__init__(**kwargs) - self.type = type - self.user_assigned_identity = user_assigned_identity + def __init__( + self, + *, + value: Optional[List["EventSubscription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(EventSubscriptionsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class EventSubscriptionUpdateParameters(Model): +class EventSubscriptionUpdateParameters(msrest.serialization.Model): """Properties of the Event Subscription update. - :param destination: Information about the destination where events have to - be delivered for the event subscription. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type destination: - ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination - where events have to be delivered for the event subscription. - Uses the managed identity setup on the parent resource (topic / domain) to - acquire the authentication tokens being used during delivery / - dead-lettering. - :type delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :param destination: Information about the destination where events have to be delivered for the + event subscription. + :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. :type labels: list[str] - :param expiration_time_utc: Information about the expiration time for the - event subscription. - :type expiration_time_utc: datetime - :param event_delivery_schema: The event delivery schema for the event - subscription. Possible values include: 'EventGridSchema', - 'CustomInputSchema', 'CloudEventSchemaV1_0' - :type event_delivery_schema: str or - ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to - configure maximum number of delivery attempts and time to live for events. + :param expiration_time_utc: Information about the expiration time for the event subscription. + :type expiration_time_utc: ~datetime.datetime + :param event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :param retry_policy: The retry policy for events. This can be used to configure maximum number + of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The dead letter destination of the event - subscription. Any event that cannot be delivered to its' destination is - sent to the dead letter destination. - Uses Azure Event Grid's identity to acquire the authentication tokens - being used during delivery / dead-lettering. - :type dead_letter_destination: - ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of - the event subscription. Any event that cannot be delivered to its' - destination is sent to the dead letter destination. - Uses the managed identity setup on the parent resource (topic / domain) to - acquire the authentication tokens being used during delivery / - dead-lettering. - :type dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + :param dead_letter_destination: The DeadLetter destination of the event subscription. + :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination """ _attribute_map = { 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, - 'delivery_with_resource_identity': {'key': 'deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, - 'dead_letter_with_resource_identity': {'key': 'deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, *, destination=None, delivery_with_resource_identity=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, dead_letter_with_resource_identity=None, **kwargs) -> None: + def __init__( + self, + *, + destination: Optional["EventSubscriptionDestination"] = None, + filter: Optional["EventSubscriptionFilter"] = None, + labels: Optional[List[str]] = None, + expiration_time_utc: Optional[datetime.datetime] = None, + event_delivery_schema: Optional[Union[str, "EventDeliverySchema"]] = None, + retry_policy: Optional["RetryPolicy"] = None, + dead_letter_destination: Optional["DeadLetterDestination"] = None, + **kwargs + ): super(EventSubscriptionUpdateParameters, self).__init__(**kwargs) self.destination = destination - self.delivery_with_resource_identity = delivery_with_resource_identity self.filter = filter self.labels = labels self.expiration_time_utc = expiration_time_utc self.event_delivery_schema = event_delivery_schema self.retry_policy = retry_policy self.dead_letter_destination = dead_letter_destination - self.dead_letter_with_resource_identity = dead_letter_with_resource_identity class EventType(Resource): """Event Type for a subject under a topic. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param display_name: Display name of the event type. :type display_name: str @@ -1031,7 +901,15 @@ class EventType(Resource): 'is_in_default_set': {'key': 'properties.isInDefaultSet', 'type': 'bool'}, } - def __init__(self, *, display_name: str=None, description: str=None, schema_url: str=None, is_in_default_set: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + schema_url: Optional[str] = None, + is_in_default_set: Optional[bool] = None, + **kwargs + ): super(EventType, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -1039,56 +917,38 @@ def __init__(self, *, display_name: str=None, description: str=None, schema_url: self.is_in_default_set = is_in_default_set -class ExtensionTopic(Resource): - """Event grid Extension Topic. This is used for getting Event Grid related - metrics for Azure resources. +class EventTypesListResult(msrest.serialization.Model): + """Result of the List Event Types operation. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param description: Description of the extension topic. - :type description: str - :param system_topic: System topic resource id which is mapped to the - source. - :type system_topic: str + :param value: A collection of event types. + :type value: list[~azure.mgmt.eventgrid.models.EventType] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'system_topic': {'key': 'properties.systemTopic', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EventType]'}, } - def __init__(self, *, description: str=None, system_topic: str=None, **kwargs) -> None: - super(ExtensionTopic, self).__init__(**kwargs) - self.description = description - self.system_topic = system_topic + def __init__( + self, + *, + value: Optional[List["EventType"]] = None, + **kwargs + ): + super(EventTypesListResult, self).__init__(**kwargs) + self.value = value class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the HybridConnection destination for an event - subscription. + """Information about the HybridConnection destination for an event subscription. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of an hybrid connection that is - the destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource ID of an hybrid connection that is the destination of an + event subscription. :type resource_id: str """ @@ -1101,56 +961,24 @@ class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination) 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + **kwargs + ): super(HybridConnectionEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'HybridConnection' # type: str self.resource_id = resource_id - self.endpoint_type = 'HybridConnection' - - -class IdentityInfo(Model): - """The identity information for the resource. - - :param type: The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of - user-assigned identities. The type 'None' will remove any identity. - Possible values include: 'None', 'SystemAssigned', 'UserAssigned', - 'SystemAssigned, UserAssigned' - :type type: str or ~azure.mgmt.eventgrid.models.IdentityType - :param principal_id: The principal ID of resource identity. - :type principal_id: str - :param tenant_id: The tenant ID of resource. - :type tenant_id: str - :param user_assigned_identities: The list of user identities associated - with the resource. The user identity dictionary key references will be ARM - resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - This property is currently not used and reserved for future usage. - :type user_assigned_identities: dict[str, - ~azure.mgmt.eventgrid.models.UserIdentityProperties] - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, - } - - def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, user_assigned_identities=None, **kwargs) -> None: - super(IdentityInfo, self).__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities -class InboundIpRule(Model): +class InboundIpRule(msrest.serialization.Model): """InboundIpRule. :param ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. :type ip_mask: str - :param action: Action to perform based on the match or no match of the - IpMask. Possible values include: 'Allow' + :param action: Action to perform based on the match or no match of the IpMask. Possible values + include: "Allow". :type action: str or ~azure.mgmt.eventgrid.models.IpActionType """ @@ -1159,25 +987,29 @@ class InboundIpRule(Model): 'action': {'key': 'action', 'type': 'str'}, } - def __init__(self, *, ip_mask: str=None, action=None, **kwargs) -> None: + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Optional[Union[str, "IpActionType"]] = None, + **kwargs + ): super(InboundIpRule, self).__init__(**kwargs) self.ip_mask = ip_mask self.action = action -class InputSchemaMapping(Model): - """By default, Event Grid expects events to be in the Event Grid event schema. - Specifying an input schema mapping enables publishing to Event Grid using a - custom input schema. Currently, the only supported type of - InputSchemaMapping is 'JsonInputSchemaMapping'. +class InputSchemaMapping(msrest.serialization.Model): + """By default, Event Grid expects events to be in the Event Grid event schema. Specifying an input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JsonInputSchemaMapping + sub-classes are: JsonInputSchemaMapping. All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Constant filled by server. - :type input_schema_mapping_type: str + :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType """ _validation = { @@ -1192,19 +1024,19 @@ class InputSchemaMapping(Model): 'input_schema_mapping_type': {'Json': 'JsonInputSchemaMapping'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(InputSchemaMapping, self).__init__(**kwargs) - self.input_schema_mapping_type = None + self.input_schema_mapping_type = None # type: Optional[str] -class JsonField(Model): - """This is used to express the source of an input schema mapping for a single - target field in the Event Grid Event schema. This is currently used in the - mappings for the 'id', 'topic' and 'eventtime' properties. This represents - a field in the input event schema. +class JsonField(msrest.serialization.Model): + """This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the input event schema. - :param source_field: Name of a field in the input event schema that's to - be used as the source of a mapping. + :param source_field: Name of a field in the input event schema that's to be used as the source + of a mapping. :type source_field: str """ @@ -1212,27 +1044,27 @@ class JsonField(Model): 'source_field': {'key': 'sourceField', 'type': 'str'}, } - def __init__(self, *, source_field: str=None, **kwargs) -> None: + def __init__( + self, + *, + source_field: Optional[str] = None, + **kwargs + ): super(JsonField, self).__init__(**kwargs) self.source_field = source_field -class JsonFieldWithDefault(Model): - """This is used to express the source of an input schema mapping for a single - target field - in the Event Grid Event schema. This is currently used in the mappings for - the 'subject', - 'eventtype' and 'dataversion' properties. This represents a field in the - input event schema - along with a default value to be used, and at least one of these two - properties should be provided. +class JsonFieldWithDefault(msrest.serialization.Model): + """This is used to express the source of an input schema mapping for a single target field +in the Event Grid Event schema. This is currently used in the mappings for the 'subject', +'eventtype' and 'dataversion' properties. This represents a field in the input event schema +along with a default value to be used, and at least one of these two properties should be provided. - :param source_field: Name of a field in the input event schema that's to - be used as the source of a mapping. + :param source_field: Name of a field in the input event schema that's to be used as the source + of a mapping. :type source_field: str - :param default_value: The default value to be used for mapping when a - SourceField is not provided or if there's no property with the specified - name in the published JSON event payload. + :param default_value: The default value to be used for mapping when a SourceField is not + provided or if there's no property with the specified name in the published JSON event payload. :type default_value: str """ @@ -1241,38 +1073,38 @@ class JsonFieldWithDefault(Model): 'default_value': {'key': 'defaultValue', 'type': 'str'}, } - def __init__(self, *, source_field: str=None, default_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + source_field: Optional[str] = None, + default_value: Optional[str] = None, + **kwargs + ): super(JsonFieldWithDefault, self).__init__(**kwargs) self.source_field = source_field self.default_value = default_value class JsonInputSchemaMapping(InputSchemaMapping): - """This enables publishing to Event Grid using a custom input schema. This can - be used to map properties from a custom input JSON schema to the Event Grid - event schema. + """This enables publishing to Event Grid using a custom input schema. This can be used to map properties from a custom input JSON schema to the Event Grid event schema. All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Constant filled by server. - :type input_schema_mapping_type: str - :param id: The mapping information for the Id property of the Event Grid - Event. + :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :param id: The mapping information for the Id property of the Event Grid Event. :type id: ~azure.mgmt.eventgrid.models.JsonField - :param topic: The mapping information for the Topic property of the Event - Grid Event. + :param topic: The mapping information for the Topic property of the Event Grid Event. :type topic: ~azure.mgmt.eventgrid.models.JsonField - :param event_time: The mapping information for the EventTime property of - the Event Grid Event. + :param event_time: The mapping information for the EventTime property of the Event Grid Event. :type event_time: ~azure.mgmt.eventgrid.models.JsonField - :param event_type: The mapping information for the EventType property of - the Event Grid Event. + :param event_type: The mapping information for the EventType property of the Event Grid Event. :type event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param subject: The mapping information for the Subject property of the - Event Grid Event. + :param subject: The mapping information for the Subject property of the Event Grid Event. :type subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param data_version: The mapping information for the DataVersion property - of the Event Grid Event. + :param data_version: The mapping information for the DataVersion property of the Event Grid + Event. :type data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault """ @@ -1290,15 +1122,25 @@ class JsonInputSchemaMapping(InputSchemaMapping): 'data_version': {'key': 'properties.dataVersion', 'type': 'JsonFieldWithDefault'}, } - def __init__(self, *, id=None, topic=None, event_time=None, event_type=None, subject=None, data_version=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional["JsonField"] = None, + topic: Optional["JsonField"] = None, + event_time: Optional["JsonField"] = None, + event_type: Optional["JsonFieldWithDefault"] = None, + subject: Optional["JsonFieldWithDefault"] = None, + data_version: Optional["JsonFieldWithDefault"] = None, + **kwargs + ): super(JsonInputSchemaMapping, self).__init__(**kwargs) + self.input_schema_mapping_type = 'Json' # type: str self.id = id self.topic = topic self.event_time = event_time self.event_type = event_type self.subject = subject self.data_version = data_version - self.input_schema_mapping_type = 'Json' class NumberGreaterThanAdvancedFilter(AdvancedFilter): @@ -1306,11 +1148,14 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1320,15 +1165,21 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, key: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(NumberGreaterThanAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberGreaterThan' # type: str self.value = value - self.operator_type = 'NumberGreaterThan' class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): @@ -1336,11 +1187,14 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1350,15 +1204,21 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, key: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(NumberGreaterThanOrEqualsAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberGreaterThanOrEquals' # type: str self.value = value - self.operator_type = 'NumberGreaterThanOrEquals' class NumberInAdvancedFilter(AdvancedFilter): @@ -1366,11 +1226,14 @@ class NumberInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[float] """ @@ -1380,15 +1243,21 @@ class NumberInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[float]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[float]] = None, + **kwargs + ): super(NumberInAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberIn' # type: str self.values = values - self.operator_type = 'NumberIn' class NumberLessThanAdvancedFilter(AdvancedFilter): @@ -1396,11 +1265,14 @@ class NumberLessThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1410,15 +1282,21 @@ class NumberLessThanAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, key: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(NumberLessThanAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberLessThan' # type: str self.value = value - self.operator_type = 'NumberLessThan' class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): @@ -1426,11 +1304,14 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param value: The filter value. :type value: float """ @@ -1440,15 +1321,21 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, key: str=None, value: float=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[float] = None, + **kwargs + ): super(NumberLessThanOrEqualsAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberLessThanOrEquals' # type: str self.value = value - self.operator_type = 'NumberLessThanOrEquals' class NumberNotInAdvancedFilter(AdvancedFilter): @@ -1456,11 +1343,14 @@ class NumberNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[float] """ @@ -1470,27 +1360,33 @@ class NumberNotInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[float]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[float]] = None, + **kwargs + ): super(NumberNotInAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberNotIn' # type: str self.values = values - self.operator_type = 'NumberNotIn' -class Operation(Model): +class Operation(msrest.serialization.Model): """Represents an operation returned by the GetOperations request. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param display: Display name of the operation + :param display: Display name of the operation. :type display: ~azure.mgmt.eventgrid.models.OperationInfo - :param origin: Origin of the operation + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation + :param properties: Properties of the operation. :type properties: object """ @@ -1501,7 +1397,15 @@ class Operation(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationInfo"] = None, + origin: Optional[str] = None, + properties: Optional[object] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1509,16 +1413,16 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties self.properties = properties -class OperationInfo(Model): +class OperationInfo(msrest.serialization.Model): """Information about an operation. - :param provider: Name of the provider + :param provider: Name of the provider. :type provider: str - :param resource: Name of the resource type + :param resource: Name of the resource type. :type resource: str - :param operation: Name of the operation + :param operation: Name of the operation. :type operation: str - :param description: Description of the operation + :param description: Description of the operation. :type description: str """ @@ -1529,7 +1433,15 @@ class OperationInfo(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationInfo, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1537,482 +1449,28 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class PartnerNamespace(TrackedResource): - """EventGrid Partner Namespace. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the partner namespace. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerNamespaceProvisioningState - :param partner_registration_fully_qualified_id: The fully qualified ARM Id - of the partner registration that should be associated with this partner - namespace. This takes the following format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. - :type partner_registration_fully_qualified_id: str - :ivar endpoint: Endpoint for the partner namespace. - :vartype endpoint: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'endpoint': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_registration_fully_qualified_id': {'key': 'properties.partnerRegistrationFullyQualifiedId', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - } - - def __init__(self, *, location: str, tags=None, partner_registration_fully_qualified_id: str=None, **kwargs) -> None: - super(PartnerNamespace, self).__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.partner_registration_fully_qualified_id = partner_registration_fully_qualified_id - self.endpoint = None - - -class PartnerNamespaceRegenerateKeyRequest(Model): - """PartnerNamespace regenerate shared access key request. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. Key name to regenerate (key1 or key2). - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__(self, *, key_name: str, **kwargs) -> None: - super(PartnerNamespaceRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = key_name - - -class PartnerNamespaceSharedAccessKeys(Model): - """Shared access keys of the partner namespace. - - :param key1: Shared access key1 for the partner namespace. - :type key1: str - :param key2: Shared access key2 for the partner namespace. - :type key2: str - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, - } - - def __init__(self, *, key1: str=None, key2: str=None, **kwargs) -> None: - super(PartnerNamespaceSharedAccessKeys, self).__init__(**kwargs) - self.key1 = key1 - self.key2 = key2 - - -class PartnerNamespaceUpdateParameters(Model): - """Properties of the PartnerNamespace update. - - :param tags: Tags of the partner namespace. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, tags=None, **kwargs) -> None: - super(PartnerNamespaceUpdateParameters, self).__init__(**kwargs) - self.tags = tags - - -class PartnerRegistration(TrackedResource): - """Information about a partner registration. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the partner registration. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerRegistrationProvisioningState - :param partner_name: Official name of the partner name. For example: - "Contoso". - :type partner_name: str - :param partner_resource_type_name: Name of the partner resource type. - :type partner_resource_type_name: str - :param partner_resource_type_display_name: Display name of the partner - resource type. - :type partner_resource_type_display_name: str - :param partner_resource_type_description: Short description of the partner - resource type. The length of this description should not exceed 256 - characters. - :type partner_resource_type_description: str - :param long_description: Long description for the custom scenarios and - integration to be displayed in the portal if needed. - Length of this description should not exceed 2048 characters. - :type long_description: str - :param partner_customer_service_number: The customer service number of the - publisher. The expected phone format should start with a '+' sign - followed by the country code. The remaining digits are then followed. Only - digits and spaces are allowed and its - length cannot exceed 16 digits including country code. Examples of valid - phone numbers are: +1 515 123 4567 and - +966 7 5115 2471. Examples of invalid phone numbers are: +1 (515) - 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 - :type partner_customer_service_number: str - :param partner_customer_service_extension: The extension of the customer - service number of the publisher. Only digits are allowed and number of - digits should not exceed 10. - :type partner_customer_service_extension: str - :param customer_service_uri: The extension of the customer service URI of - the publisher. - :type customer_service_uri: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param logo_uri: URI of the logo. - :type logo_uri: str - :param visibility_state: Visibility state of the partner registration. - Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' - :type visibility_state: str or - ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState - :param authorized_azure_subscription_ids: List of Azure subscription Ids - that are authorized to create a partner namespace - associated with this partner registration. This is an optional property. - Creating - partner namespaces is always permitted under the same Azure subscription - as the one used - for creating the partner registration. - :type authorized_azure_subscription_ids: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, - 'partner_resource_type_name': {'key': 'properties.partnerResourceTypeName', 'type': 'str'}, - 'partner_resource_type_display_name': {'key': 'properties.partnerResourceTypeDisplayName', 'type': 'str'}, - 'partner_resource_type_description': {'key': 'properties.partnerResourceTypeDescription', 'type': 'str'}, - 'long_description': {'key': 'properties.longDescription', 'type': 'str'}, - 'partner_customer_service_number': {'key': 'properties.partnerCustomerServiceNumber', 'type': 'str'}, - 'partner_customer_service_extension': {'key': 'properties.partnerCustomerServiceExtension', 'type': 'str'}, - 'customer_service_uri': {'key': 'properties.customerServiceUri', 'type': 'str'}, - 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, - 'logo_uri': {'key': 'properties.logoUri', 'type': 'str'}, - 'visibility_state': {'key': 'properties.visibilityState', 'type': 'str'}, - 'authorized_azure_subscription_ids': {'key': 'properties.authorizedAzureSubscriptionIds', 'type': '[str]'}, - } - - def __init__(self, *, location: str, tags=None, partner_name: str=None, partner_resource_type_name: str=None, partner_resource_type_display_name: str=None, partner_resource_type_description: str=None, long_description: str=None, partner_customer_service_number: str=None, partner_customer_service_extension: str=None, customer_service_uri: str=None, setup_uri: str=None, logo_uri: str=None, visibility_state=None, authorized_azure_subscription_ids=None, **kwargs) -> None: - super(PartnerRegistration, self).__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.partner_name = partner_name - self.partner_resource_type_name = partner_resource_type_name - self.partner_resource_type_display_name = partner_resource_type_display_name - self.partner_resource_type_description = partner_resource_type_description - self.long_description = long_description - self.partner_customer_service_number = partner_customer_service_number - self.partner_customer_service_extension = partner_customer_service_extension - self.customer_service_uri = customer_service_uri - self.setup_uri = setup_uri - self.logo_uri = logo_uri - self.visibility_state = visibility_state - self.authorized_azure_subscription_ids = authorized_azure_subscription_ids - - -class PartnerRegistrationEventTypesListResult(Model): - """Result of the List Partner Registration Event Types operation. - - :param value: A collection of partner registration event types. - :type value: list[~azure.mgmt.eventgrid.models.EventType] - :param next_link: A link for the next page of partner registration event - types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EventType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: - super(PartnerRegistrationEventTypesListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PartnerRegistrationUpdateParameters(Model): - """Properties of the Partner Registration update. - - :param tags: Tags of the partner registration resource. - :type tags: dict[str, str] - :param partner_topic_type_name: Name of the partner topic type. - :type partner_topic_type_name: str - :param partner_topic_type_display_name: Display name of the partner topic - type. - :type partner_topic_type_display_name: str - :param partner_topic_type_description: Description of the partner topic - type. - :type partner_topic_type_description: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param logo_uri: URI of the partner logo. - :type logo_uri: str - :param authorized_azure_subscription_ids: List of IDs of Azure AD - applications that are authorized to create a partner namespace - associated with this partner registration. This is an optional property. - Creating - partner namespaces is always permitted under the same Azure subscription - as the one used - for creating the partner registration. - :type authorized_azure_subscription_ids: list[str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'partner_topic_type_name': {'key': 'partnerTopicTypeName', 'type': 'str'}, - 'partner_topic_type_display_name': {'key': 'partnerTopicTypeDisplayName', 'type': 'str'}, - 'partner_topic_type_description': {'key': 'partnerTopicTypeDescription', 'type': 'str'}, - 'setup_uri': {'key': 'setupUri', 'type': 'str'}, - 'logo_uri': {'key': 'logoUri', 'type': 'str'}, - 'authorized_azure_subscription_ids': {'key': 'authorizedAzureSubscriptionIds', 'type': '[str]'}, - } - - def __init__(self, *, tags=None, partner_topic_type_name: str=None, partner_topic_type_display_name: str=None, partner_topic_type_description: str=None, setup_uri: str=None, logo_uri: str=None, authorized_azure_subscription_ids=None, **kwargs) -> None: - super(PartnerRegistrationUpdateParameters, self).__init__(**kwargs) - self.tags = tags - self.partner_topic_type_name = partner_topic_type_name - self.partner_topic_type_display_name = partner_topic_type_display_name - self.partner_topic_type_description = partner_topic_type_description - self.setup_uri = setup_uri - self.logo_uri = logo_uri - self.authorized_azure_subscription_ids = authorized_azure_subscription_ids - - -class PartnerTopic(TrackedResource): - """EventGrid Partner Topic. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :param source: Source associated with this partner topic. This represents - a unique partner resource. - :type source: str - :param expiration_time_if_not_activated_utc: Expiration time of the - partner topic. If this timer expires while the partner topic is still - never activated, - the partner topic and corresponding event channel are deleted. - :type expiration_time_if_not_activated_utc: datetime - :ivar provisioning_state: Provisioning state of the partner topic. - Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicProvisioningState - :param activation_state: Activation state of the partner topic. Possible - values include: 'NeverActivated', 'Activated', 'Deactivated' - :type activation_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicActivationState - :param partner_topic_friendly_description: Friendly description about the - topic. This can be set by the publisher/partner to show custom description - for the customer partner topic. - This will be helpful to remove any ambiguity of the origin of creation of - the partner topic for the customer. - :type partner_topic_friendly_description: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'activation_state': {'key': 'properties.activationState', 'type': 'str'}, - 'partner_topic_friendly_description': {'key': 'properties.partnerTopicFriendlyDescription', 'type': 'str'}, - } - - def __init__(self, *, location: str, tags=None, source: str=None, expiration_time_if_not_activated_utc=None, activation_state=None, partner_topic_friendly_description: str=None, **kwargs) -> None: - super(PartnerTopic, self).__init__(location=location, tags=tags, **kwargs) - self.source = source - self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc - self.provisioning_state = None - self.activation_state = activation_state - self.partner_topic_friendly_description = partner_topic_friendly_description - - -class PartnerTopicType(Resource): - """Properties of a partner topic type. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param partner_name: Official name of the partner. - :type partner_name: str - :param topic_type_name: Name of the partner topic type. This name should - be unique among all partner topic types names. - :type topic_type_name: str - :param display_name: Display Name for the partner topic type. - :type display_name: str - :param description: Description of the partner topic type. - :type description: str - :param setup_uri: URI of the partner website that can be used by Azure - customers to setup Event Grid - integration on an event source. - :type setup_uri: str - :param authorization_state: Status of whether the customer has authorized - a partner to create partner topics - in the customer's subscription. Possible values include: 'NotApplicable', - 'NotAuthorized', 'Authorized' - :type authorization_state: str or - ~azure.mgmt.eventgrid.models.PartnerTopicTypeAuthorizationState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, - 'topic_type_name': {'key': 'properties.topicTypeName', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, - 'authorization_state': {'key': 'properties.authorizationState', 'type': 'str'}, - } - - def __init__(self, *, partner_name: str=None, topic_type_name: str=None, display_name: str=None, description: str=None, setup_uri: str=None, authorization_state=None, **kwargs) -> None: - super(PartnerTopicType, self).__init__(**kwargs) - self.partner_name = partner_name - self.topic_type_name = topic_type_name - self.display_name = display_name - self.description = description - self.setup_uri = setup_uri - self.authorization_state = authorization_state - - -class PartnerTopicTypesListResult(Model): - """Result of the List Partner Topic Types operation. +class OperationsListResult(msrest.serialization.Model): + """Result of the List Operations operation. - :param value: A collection of partner topic types. - :type value: list[~azure.mgmt.eventgrid.models.PartnerTopicType] + :param value: A collection of operations. + :type value: list[~azure.mgmt.eventgrid.models.Operation] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PartnerTopicType]'}, + 'value': {'key': 'value', 'type': '[Operation]'}, } - def __init__(self, *, value=None, **kwargs) -> None: - super(PartnerTopicTypesListResult, self).__init__(**kwargs) + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(OperationsListResult, self).__init__(**kwargs) self.value = value -class PartnerTopicUpdateParameters(Model): - """Properties of the Partner Topic update. - - :param tags: Tags of the partner topic. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, tags=None, **kwargs) -> None: - super(PartnerTopicUpdateParameters, self).__init__(**kwargs) - self.tags = tags - - -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """PrivateEndpoint information. :param id: The ARM identifier for Private Endpoint. @@ -2023,7 +1481,12 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -2031,29 +1494,23 @@ def __init__(self, *, id: str=None, **kwargs) -> None: class PrivateEndpointConnection(Resource): """PrivateEndpointConnection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str - :param private_endpoint: The Private Endpoint resource for this - Connection. + :param private_endpoint: The Private Endpoint resource for this Connection. :type private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint :param group_ids: GroupIds from the private link service resource. :type group_ids: list[str] - :param private_link_service_connection_state: Details about the state of - the connection. - :type private_link_service_connection_state: - ~azure.mgmt.eventgrid.models.ConnectionState - :param provisioning_state: Provisioning state of the Private Endpoint - Connection. Possible values include: 'Creating', 'Updating', 'Deleting', - 'Succeeded', 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState """ _validation = { @@ -2072,7 +1529,15 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, group_ids=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + group_ids: Optional[List[str]] = None, + private_link_service_connection_state: Optional["ConnectionState"] = None, + provisioning_state: Optional[Union[str, "ResourceProvisioningState"]] = None, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.group_ids = group_ids @@ -2080,9 +1545,41 @@ def __init__(self, *, private_endpoint=None, group_ids=None, private_link_servic self.provisioning_state = provisioning_state -class PrivateLinkResource(Model): +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): """Information of the private link resource. + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str :param group_id: :type group_id: str :param display_name: @@ -2091,60 +1588,72 @@ class PrivateLinkResource(Model): :type required_members: list[str] :param required_zone_names: :type required_zone_names: list[str] - :param id: Fully qualified identifier of the resource. - :type id: str - :param name: Name of the resource - :type name: str - :param type: Type of the resource - :type type: str """ _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, group_id: str=None, display_name: str=None, required_members=None, required_zone_names=None, id: str=None, name: str=None, type: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + display_name: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type self.group_id = group_id self.display_name = display_name self.required_members = required_members self.required_zone_names = required_zone_names - self.id = id - self.name = name - self.type = type -class ResourceSku(Model): - """Describes an EventGrid Resource Sku. +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. - :param name: The Sku name of the resource. The possible values are: Basic - or Premium. Possible values include: 'Basic', 'Premium' - :type name: str or ~azure.mgmt.eventgrid.models.Sku + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, name=None, **kwargs) -> None: - super(ResourceSku, self).__init__(**kwargs) - self.name = name + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class RetryPolicy(Model): +class RetryPolicy(msrest.serialization.Model): """Information about the retry policy for an event subscription. - :param max_delivery_attempts: Maximum number of delivery retry attempts - for events. + :param max_delivery_attempts: Maximum number of delivery retry attempts for events. :type max_delivery_attempts: int - :param event_time_to_live_in_minutes: Time To Live (in minutes) for - events. + :param event_time_to_live_in_minutes: Time To Live (in minutes) for events. :type event_time_to_live_in_minutes: int """ @@ -2153,7 +1662,13 @@ class RetryPolicy(Model): 'event_time_to_live_in_minutes': {'key': 'eventTimeToLiveInMinutes', 'type': 'int'}, } - def __init__(self, *, max_delivery_attempts: int=None, event_time_to_live_in_minutes: int=None, **kwargs) -> None: + def __init__( + self, + *, + max_delivery_attempts: Optional[int] = None, + event_time_to_live_in_minutes: Optional[int] = None, + **kwargs + ): super(RetryPolicy, self).__init__(**kwargs) self.max_delivery_attempts = max_delivery_attempts self.event_time_to_live_in_minutes = event_time_to_live_in_minutes @@ -2164,10 +1679,12 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + destination of an event subscription. :type resource_id: str """ @@ -2180,22 +1697,28 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + **kwargs + ): super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'ServiceBusQueue' # type: str self.resource_id = resource_id - self.endpoint_type = 'ServiceBusQueue' class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus topic destination for an event - subscription. + """Information about the service bus topic destination for an event subscription. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus Topic destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic + destination of an event subscription. :type resource_id: str """ @@ -2208,10 +1731,15 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + **kwargs + ): super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'ServiceBusTopic' # type: str self.resource_id = resource_id - self.endpoint_type = 'ServiceBusTopic' class StorageBlobDeadLetterDestination(DeadLetterDestination): @@ -2219,13 +1747,14 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that is - the destination of the deadletter events + :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType + :param resource_id: The Azure Resource ID of the storage account that is the destination of the + deadletter events. :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is - the destination of the deadletter events + :param blob_container_name: The name of the Storage blob container that is the destination of + the deadletter events. :type blob_container_name: str """ @@ -2239,11 +1768,17 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): 'blob_container_name': {'key': 'properties.blobContainerName', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, blob_container_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + blob_container_name: Optional[str] = None, + **kwargs + ): super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) + self.endpoint_type = 'StorageBlob' # type: str self.resource_id = resource_id self.blob_container_name = blob_container_name - self.endpoint_type = 'StorageBlob' class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): @@ -2251,13 +1786,15 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that - contains the queue that is the destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param resource_id: The Azure Resource ID of the storage account that contains the queue that + is the destination of an event subscription. :type resource_id: str - :param queue_name: The name of the Storage queue under a storage account - that is the destination of an event subscription. + :param queue_name: The name of the Storage queue under a storage account that is the + destination of an event subscription. :type queue_name: str """ @@ -2271,11 +1808,17 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): 'queue_name': {'key': 'properties.queueName', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, queue_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + queue_name: Optional[str] = None, + **kwargs + ): super(StorageQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'StorageQueue' # type: str self.resource_id = resource_id self.queue_name = queue_name - self.endpoint_type = 'StorageQueue' class StringBeginsWithAdvancedFilter(AdvancedFilter): @@ -2283,11 +1826,14 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2297,15 +1843,21 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): super(StringBeginsWithAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringBeginsWith' # type: str self.values = values - self.operator_type = 'StringBeginsWith' class StringContainsAdvancedFilter(AdvancedFilter): @@ -2313,11 +1865,14 @@ class StringContainsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2327,15 +1882,21 @@ class StringContainsAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): super(StringContainsAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringContains' # type: str self.values = values - self.operator_type = 'StringContains' class StringEndsWithAdvancedFilter(AdvancedFilter): @@ -2343,11 +1904,14 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2357,15 +1921,21 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): super(StringEndsWithAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringEndsWith' # type: str self.values = values - self.operator_type = 'StringEndsWith' class StringInAdvancedFilter(AdvancedFilter): @@ -2373,11 +1943,14 @@ class StringInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2387,15 +1960,21 @@ class StringInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): super(StringInAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringIn' # type: str self.values = values - self.operator_type = 'StringIn' class StringNotInAdvancedFilter(AdvancedFilter): @@ -2403,11 +1982,14 @@ class StringNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param key: The field/property in the event based on which you want to - filter. + :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains". + :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :param key: The field/property in the event based on which you want to filter. :type key: str - :param operator_type: Required. Constant filled by server. - :type operator_type: str :param values: The set of filter values. :type values: list[str] """ @@ -2417,149 +1999,67 @@ class StringNotInAdvancedFilter(AdvancedFilter): } _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, } - def __init__(self, *, key: str=None, values=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): super(StringNotInAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringNotIn' # type: str self.values = values - self.operator_type = 'StringNotIn' - - -class SystemTopic(TrackedResource): - """EventGrid System Topic. - - 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: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource - :vartype name: str - :ivar type: Type of the resource - :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: Tags of the resource. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the system topic. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.ResourceProvisioningState - :param source: Source for the system topic. - :type source: str - :param topic_type: TopicType for the system topic. - :type topic_type: str - :ivar metric_resource_id: Metric resource id for the system topic. - :vartype metric_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'metric_resource_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'source': {'key': 'properties.source', 'type': 'str'}, - 'topic_type': {'key': 'properties.topicType', 'type': 'str'}, - 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, - } - - def __init__(self, *, location: str, tags=None, source: str=None, topic_type: str=None, **kwargs) -> None: - super(SystemTopic, self).__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.source = source - self.topic_type = topic_type - self.metric_resource_id = None - - -class SystemTopicUpdateParameters(Model): - """Properties of the System Topic update. - - :param tags: Tags of the system topic. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, tags=None, **kwargs) -> None: - super(SystemTopicUpdateParameters, self).__init__(**kwargs) - self.tags = tags class Topic(TrackedResource): """EventGrid Topic. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param location: Required. Location of the resource. :type location: str - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] :param private_endpoint_connections: :type private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar provisioning_state: Provisioning state of the topic. Possible values - include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', - 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.TopicProvisioningState + :ivar provisioning_state: Provisioning state of the topic. Possible values include: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicProvisioningState :ivar endpoint: Endpoint for the topic. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should - expect for incoming events published to the topic. Possible values - include: 'EventGridSchema', 'CustomEventSchema', 'CloudEventSchemaV1_0'. - Default value: "EventGridSchema" . + :param input_schema: This determines the format that Event Grid should expect for incoming + events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", + "CloudEventSchemaV1_0". :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: This enables publishing using custom event - schemas. An InputSchemaMapping can be specified to map various properties - of a source schema to various required properties of the EventGridEvent - schema. - :type input_schema_mapping: - ~azure.mgmt.eventgrid.models.InputSchemaMapping + :param input_schema_mapping: This enables publishing using custom event schemas. An + InputSchemaMapping can be specified to map various properties of a source schema to various + required properties of the EventGridEvent schema. + :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the topic. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -2586,11 +2086,20 @@ class Topic(TrackedResource): 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, *, location: str, tags=None, private_endpoint_connections=None, input_schema="EventGridSchema", input_schema_mapping=None, public_network_access=None, inbound_ip_rules=None, sku=None, identity=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + input_schema: Optional[Union[str, "InputSchema"]] = None, + input_schema_mapping: Optional["InputSchemaMapping"] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + **kwargs + ): super(Topic, self).__init__(location=location, tags=tags, **kwargs) self.private_endpoint_connections = private_endpoint_connections self.provisioning_state = None @@ -2600,16 +2109,14 @@ def __init__(self, *, location: str, tags=None, private_endpoint_connections=Non self.metric_resource_id = None self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules - self.sku = sku - self.identity = identity -class TopicRegenerateKeyRequest(Model): +class TopicRegenerateKeyRequest(msrest.serialization.Model): """Topic regenerate share access key request. All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2 + :param key_name: Required. Key name to regenerate key1 or key2. :type key_name: str """ @@ -2621,12 +2128,17 @@ class TopicRegenerateKeyRequest(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, key_name: str, **kwargs) -> None: + def __init__( + self, + *, + key_name: str, + **kwargs + ): super(TopicRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = key_name -class TopicSharedAccessKeys(Model): +class TopicSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Topic. :param key1: Shared access key1 for the topic. @@ -2640,23 +2152,54 @@ class TopicSharedAccessKeys(Model): 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, *, key1: str=None, key2: str=None, **kwargs) -> None: + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): super(TopicSharedAccessKeys, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 +class TopicsListResult(msrest.serialization.Model): + """Result of the List Topics operation. + + :param value: A collection of Topics. + :type value: list[~azure.mgmt.eventgrid.models.Topic] + :param next_link: A link for the next page of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Topic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Topic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(TopicsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class TopicTypeInfo(Resource): """Properties of a topic type info. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified identifier of the resource. :vartype id: str - :ivar name: Name of the resource + :ivar name: Name of the resource. :vartype name: str - :ivar type: Type of the resource + :ivar type: Type of the resource. :vartype type: str :param provider: Namespace of the provider of the topic type. :type provider: str @@ -2664,17 +2207,13 @@ class TopicTypeInfo(Resource): :type display_name: str :param description: Description of the topic type. :type description: str - :param resource_region_type: Region type of the resource. Possible values - include: 'RegionalResource', 'GlobalResource' - :type resource_region_type: str or - ~azure.mgmt.eventgrid.models.ResourceRegionType - :param provisioning_state: Provisioning state of the topic type. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', - 'Canceled', 'Failed' - :type provisioning_state: str or - ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :param supported_locations: List of locations supported by this topic - type. + :param resource_region_type: Region type of the resource. Possible values include: + "RegionalResource", "GlobalResource". + :type resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :param provisioning_state: Provisioning state of the topic type. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :param supported_locations: List of locations supported by this topic type. :type supported_locations: list[str] :param source_resource_format: Source resource format. :type source_resource_format: str @@ -2699,7 +2238,18 @@ class TopicTypeInfo(Resource): 'source_resource_format': {'key': 'properties.sourceResourceFormat', 'type': 'str'}, } - def __init__(self, *, provider: str=None, display_name: str=None, description: str=None, resource_region_type=None, provisioning_state=None, supported_locations=None, source_resource_format: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + resource_region_type: Optional[Union[str, "ResourceRegionType"]] = None, + provisioning_state: Optional[Union[str, "TopicTypeProvisioningState"]] = None, + supported_locations: Optional[List[str]] = None, + source_resource_format: Optional[str] = None, + **kwargs + ): super(TopicTypeInfo, self).__init__(**kwargs) self.provider = provider self.display_name = display_name @@ -2710,93 +2260,89 @@ def __init__(self, *, provider: str=None, display_name: str=None, description: s self.source_resource_format = source_resource_format -class TopicUpdateParameters(Model): +class TopicTypesListResult(msrest.serialization.Model): + """Result of the List Topic Types operation. + + :param value: A collection of topic types. + :type value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicTypeInfo]'}, + } + + def __init__( + self, + *, + value: Optional[List["TopicTypeInfo"]] = None, + **kwargs + ): + super(TopicTypesListResult, self).__init__(**kwargs) + self.value = value + + +class TopicUpdateParameters(msrest.serialization.Model): """Properties of the Topic update. - :param tags: Tags of the resource. + :param tags: A set of tags. Tags of the resource. :type tags: dict[str, str] - :param identity: Resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over - public network. By default it is enabled. - You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - :type public_network_access: str or - ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :param inbound_ip_rules: This can be used to restrict traffic from - specific IPs instead of all IPs. Note: These are considered only if - PublicNetworkAccess is enabled. + />`. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all + IPs. Note: These are considered only if PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param sku: The Sku pricing tier for the topic. - :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } - def __init__(self, *, tags=None, identity=None, public_network_access=None, inbound_ip_rules=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + **kwargs + ): super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = tags - self.identity = identity self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules - self.sku = sku - - -class UserIdentityProperties(Model): - """The information about the user identity. - - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: - super(UserIdentityProperties, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id class WebHookEventSubscriptionDestination(EventSubscriptionDestination): """Information about the webhook destination for an event subscription. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param endpoint_url: The URL that represents the endpoint of the - destination of an event subscription. + :param endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". + :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :param endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. :type endpoint_url: str - :ivar endpoint_base_url: The base URL that represents the endpoint of the - destination of an event subscription. + :ivar endpoint_base_url: The base URL that represents the endpoint of the destination of an + event subscription. :vartype endpoint_base_url: str :param max_events_per_batch: Maximum number of events per batch. :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in - Kilobytes. + :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. :type preferred_batch_size_in_kilobytes: int - :param azure_active_directory_tenant_id: The Azure Active Directory Tenant - ID to get the access token that will be included as the bearer token in - delivery requests. + :param azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access + token that will be included as the bearer token in delivery requests. :type azure_active_directory_tenant_id: str - :param azure_active_directory_application_id_or_uri: The Azure Active - Directory Application ID or URI to get the access token that will be - included as the bearer token in delivery requests. + :param azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID + or URI to get the access token that will be included as the bearer token in delivery requests. :type azure_active_directory_application_id_or_uri: str """ @@ -2815,12 +2361,21 @@ class WebHookEventSubscriptionDestination(EventSubscriptionDestination): 'azure_active_directory_application_id_or_uri': {'key': 'properties.azureActiveDirectoryApplicationIdOrUri', 'type': 'str'}, } - def __init__(self, *, endpoint_url: str=None, max_events_per_batch: int=None, preferred_batch_size_in_kilobytes: int=None, azure_active_directory_tenant_id: str=None, azure_active_directory_application_id_or_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + endpoint_url: Optional[str] = None, + max_events_per_batch: Optional[int] = None, + preferred_batch_size_in_kilobytes: Optional[int] = None, + azure_active_directory_tenant_id: Optional[str] = None, + azure_active_directory_application_id_or_uri: Optional[str] = None, + **kwargs + ): super(WebHookEventSubscriptionDestination, self).__init__(**kwargs) + self.endpoint_type = 'WebHook' # type: str self.endpoint_url = endpoint_url self.endpoint_base_url = None self.max_events_per_batch = max_events_per_batch self.preferred_batch_size_in_kilobytes = preferred_batch_size_in_kilobytes self.azure_active_directory_tenant_id = azure_active_directory_tenant_id self.azure_active_directory_application_id_or_uri = azure_active_directory_application_id_or_uri - self.endpoint_type = 'WebHook' diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py deleted file mode 100644 index 20d75dc4b167..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py +++ /dev/null @@ -1,196 +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 msrest.paging import Paged - - -class DomainPaged(Paged): - """ - A paging container for iterating over a list of :class:`Domain ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Domain]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainPaged, self).__init__(*args, **kwargs) -class DomainTopicPaged(Paged): - """ - A paging container for iterating over a list of :class:`DomainTopic ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DomainTopic]'} - } - - def __init__(self, *args, **kwargs): - - super(DomainTopicPaged, self).__init__(*args, **kwargs) -class EventChannelPaged(Paged): - """ - A paging container for iterating over a list of :class:`EventChannel ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[EventChannel]'} - } - - def __init__(self, *args, **kwargs): - - super(EventChannelPaged, self).__init__(*args, **kwargs) -class EventSubscriptionPaged(Paged): - """ - A paging container for iterating over a list of :class:`EventSubscription ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[EventSubscription]'} - } - - def __init__(self, *args, **kwargs): - - super(EventSubscriptionPaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) -class PartnerNamespacePaged(Paged): - """ - A paging container for iterating over a list of :class:`PartnerNamespace ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PartnerNamespace]'} - } - - def __init__(self, *args, **kwargs): - - super(PartnerNamespacePaged, self).__init__(*args, **kwargs) -class PartnerRegistrationPaged(Paged): - """ - A paging container for iterating over a list of :class:`PartnerRegistration ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PartnerRegistration]'} - } - - def __init__(self, *args, **kwargs): - - super(PartnerRegistrationPaged, self).__init__(*args, **kwargs) -class PartnerTopicPaged(Paged): - """ - A paging container for iterating over a list of :class:`PartnerTopic ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PartnerTopic]'} - } - - def __init__(self, *args, **kwargs): - - super(PartnerTopicPaged, self).__init__(*args, **kwargs) -class PrivateEndpointConnectionPaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) -class PrivateLinkResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateLinkResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) -class SystemTopicPaged(Paged): - """ - A paging container for iterating over a list of :class:`SystemTopic ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SystemTopic]'} - } - - def __init__(self, *args, **kwargs): - - super(SystemTopicPaged, self).__init__(*args, **kwargs) -class TopicPaged(Paged): - """ - A paging container for iterating over a list of :class:`Topic ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Topic]'} - } - - def __init__(self, *args, **kwargs): - - super(TopicPaged, self).__init__(*args, **kwargs) -class EventTypePaged(Paged): - """ - A paging container for iterating over a list of :class:`EventType ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[EventType]'} - } - - def __init__(self, *args, **kwargs): - - super(EventTypePaged, self).__init__(*args, **kwargs) -class TopicTypeInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`TopicTypeInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[TopicTypeInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(TopicTypeInfoPaged, self).__init__(*args, **kwargs) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py index 6a4607f4a8ba..d2719a3e3e6b 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py @@ -1,46 +1,27 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._domains_operations import DomainsOperations from ._domain_topics_operations import DomainTopicsOperations -from ._event_channels_operations import EventChannelsOperations from ._event_subscriptions_operations import EventSubscriptionsOperations -from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations -from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations from ._operations import Operations -from ._partner_namespaces_operations import PartnerNamespacesOperations -from ._partner_registrations_operations import PartnerRegistrationsOperations -from ._partner_topics_operations import PartnerTopicsOperations +from ._topics_operations import TopicsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._system_topics_operations import SystemTopicsOperations -from ._topics_operations import TopicsOperations -from ._extension_topics_operations import ExtensionTopicsOperations from ._topic_types_operations import TopicTypesOperations __all__ = [ 'DomainsOperations', 'DomainTopicsOperations', - 'EventChannelsOperations', 'EventSubscriptionsOperations', - 'SystemTopicEventSubscriptionsOperations', - 'PartnerTopicEventSubscriptionsOperations', 'Operations', - 'PartnerNamespacesOperations', - 'PartnerRegistrationsOperations', - 'PartnerTopicsOperations', + 'TopicsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', - 'SystemTopicsOperations', - 'TopicsOperations', - 'ExtensionTopicsOperations', 'TopicTypesOperations', ] diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py index a070465d5fcf..7741912f6f80 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py @@ -1,389 +1,435 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DomainTopicsOperations(object): """DomainTopicsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, domain_name, domain_topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainTopic" """Get a domain topic. Get properties of a domain topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain_topic_name: Name of the topic. :type domain_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.DomainTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainTopic + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str') + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainTopic', response) + deserialized = self._deserialize('DomainTopic', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, domain_name, domain_topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainTopic" + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str') + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('DomainTopic', response) + deserialized = self._deserialize('DomainTopic', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, domain_name, domain_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.DomainTopic"] """Create or update a domain topic. - Asynchronously creates or updates a new domain topic with the specified - parameters. + Asynchronously creates or updates a new domain topic with the specified parameters. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain_topic_name: Name of the domain topic. :type domain_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns DomainTopic or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.DomainTopic] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.DomainTopic]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DomainTopic or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.DomainTopic] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain_topic_name=domain_topic_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DomainTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DomainTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore def _delete_initial( - self, resource_group_name, domain_name, domain_topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str') + 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, domain_name, domain_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete a domain topic. Delete existing domain topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain_topic_name: Name of the domain topic. :type domain_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain_topic_name=domain_topic_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore def list_by_domain( - self, resource_group_name, domain_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainTopicsListResult"] """List domain topics. List all the topics in a domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Domain name. :type domain_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DomainTopic - :rtype: - ~azure.mgmt.eventgrid.models.DomainTopicPaged[~azure.mgmt.eventgrid.models.DomainTopic] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainTopicsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.DomainTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_domain.metadata['url'] + url = self.list_by_domain.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainTopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics'} + return ItemPaged( + get_next, extract_data + ) + list_by_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py index 0b21e61ec836..d07c370c08d9 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py @@ -1,708 +1,767 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DomainsOperations(object): """DomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" """Get a domain. Get properties of a domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Domain or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.Domain or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Domain, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Domain + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, domain_name, domain_info, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain_info, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> "models.Domain" + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_info, 'Domain') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_info, 'Domain') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, domain_name, domain_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain_info, # type: "models.Domain" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Domain"] """Create or update a domain. - Asynchronously creates or updates a new domain with the specified - parameters. + Asynchronously creates or updates a new domain with the specified parameters. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain_info: Domain information. :type domain_info: ~azure.mgmt.eventgrid.models.Domain - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Domain or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.Domain] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.Domain]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Domain] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain_info=domain_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Domain', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_info=domain_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def _delete_initial( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def delete( - self, resource_group_name, domain_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete a domain. Delete existing domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def _update_initial( - self, resource_group_name, domain_name, domain_update_parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + domain_update_parameters, # type: "models.DomainUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Domain"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Domain"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('Domain', response) + deserialized = self._deserialize('Domain', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, domain_name, domain_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + domain_name, # type: str + domain_update_parameters, # type: "models.DomainUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Domain"] """Update a domain. Asynchronously updates a domain with the specified parameters. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param domain_update_parameters: Domain update information. - :type domain_update_parameters: - ~azure.mgmt.eventgrid.models.DomainUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type domain_update_parameters: ~azure.mgmt.eventgrid.models.DomainUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Domain or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.Domain] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.Domain]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - domain_name=domain_name, - domain_update_parameters=domain_update_parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Domain"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Domain', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_update_parameters=domain_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Domain', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainsListResult"] """List domains under an Azure subscription. List all the domains under an Azure subscription. - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.eventgrid.models.DomainPaged[~azure.mgmt.eventgrid.models.Domain] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.DomainsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'} # type: ignore def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DomainsListResult"] """List domains under a resource group. List all the domains under a resource group. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Domain - :rtype: - ~azure.mgmt.eventgrid.models.DomainPaged[~azure.mgmt.eventgrid.models.Domain] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DomainsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.DomainsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DomainsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DomainPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'} # type: ignore def list_shared_access_keys( - self, resource_group_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainSharedAccessKeys" """List keys for a domain. List the two keys used to publish to a domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainSharedAccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.list_shared_access_keys.metadata['url'] + url = self.list_shared_access_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainSharedAccessKeys', response) + deserialized = self._deserialize('DomainSharedAccessKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'} + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'} # type: ignore def regenerate_key( - self, resource_group_name, domain_name, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DomainSharedAccessKeys" """Regenerate key for a domain. Regenerate a shared access key for a domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the domain. :type domain_name: str :param key_name: Key name to regenerate key1 or key2. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DomainSharedAccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DomainSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_key_request = models.DomainRegenerateKeyRequest(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.DomainSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _regenerate_key_request = models.DomainRegenerateKeyRequest(key_name=key_name) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_key.metadata['url'] + url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_key_request, 'DomainRegenerateKeyRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_regenerate_key_request, 'DomainRegenerateKeyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DomainSharedAccessKeys', response) + deserialized = self._deserialize('DomainSharedAccessKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'} + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py deleted file mode 100644 index ef4d815ffdf4..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py +++ /dev/null @@ -1,362 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class EventChannelsOperations(object): - """EventChannelsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, partner_namespace_name, event_channel_name, custom_headers=None, raw=False, **operation_config): - """Get an event channel. - - Get properties of an event channel. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param event_channel_name: Name of the event channel. - :type event_channel_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventChannel or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventChannel or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), - 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventChannel', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} - - def create_or_update( - self, resource_group_name, partner_namespace_name, event_channel_name, event_channel_info, custom_headers=None, raw=False, **operation_config): - """Create an event channel. - - Asynchronously creates a new event channel with the specified - parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param event_channel_name: Name of the event channel. - :type event_channel_name: str - :param event_channel_info: EventChannel information. - :type event_channel_info: ~azure.mgmt.eventgrid.models.EventChannel - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventChannel or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventChannel or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), - 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_channel_info, 'EventChannel') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventChannel', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} - - - def _delete_initial( - self, resource_group_name, partner_namespace_name, event_channel_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), - 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, partner_namespace_name, event_channel_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete an event channel. - - Delete existing event channel. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param event_channel_name: Name of the event channel. - :type event_channel_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - partner_namespace_name=partner_namespace_name, - event_channel_name=event_channel_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} - - def list_by_partner_namespace( - self, resource_group_name, partner_namespace_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List event channels. - - List all the event channels in a partner namespace. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventChannel - :rtype: - ~azure.mgmt.eventgrid.models.EventChannelPaged[~azure.mgmt.eventgrid.models.EventChannel] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_partner_namespace.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventChannelPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py index 7e9d680ff5c6..c67da583200c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py @@ -1,58 +1,67 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class EventSubscriptionsOperations(object): """EventSubscriptionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, scope, event_subscription_name, custom_headers=None, raw=False, **operation_config): + self, + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.EventSubscription" """Get an event subscription. Get properties of an event subscription. - :param scope: The scope of the event subscription. The scope can be a - subscription, or a resource group, or a top level resource belonging - to a resource provider namespace, or an EventGrid topic. For example, - use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' @@ -60,223 +69,240 @@ def get( :type scope: str :param event_subscription_name: Name of the event subscription. :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscription or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscription or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventSubscription + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscription', response) + deserialized = self._deserialize('EventSubscription', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} - + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _create_or_update_initial( - self, scope, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, **operation_config): + self, + scope, # type: str + event_subscription_name, # type: str + event_subscription_info, # type: "models.EventSubscription" + **kwargs # type: Any + ): + # type: (...) -> "models.EventSubscription" + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(event_subscription_info, 'EventSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) + deserialized = self._deserialize('EventSubscription', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, scope, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def begin_create_or_update( + self, + scope, # type: str + event_subscription_name, # type: str + event_subscription_info, # type: "models.EventSubscription" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.EventSubscription"] """Create or update an event subscription. - Asynchronously creates a new event subscription or updates an existing - event subscription based on the specified scope. + Asynchronously creates a new event subscription or updates an existing event subscription based + on the specified scope. - :param scope: The identifier of the resource to which the event - subscription needs to be created or updated. The scope can be a - subscription, or a resource group, or a top level resource belonging - to a resource provider namespace, or an EventGrid topic. For example, - use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and + :param scope: The identifier of the resource to which the event subscription needs to be + created or updated. The scope can be a subscription, or a resource group, or a top level + resource belonging to a resource provider namespace, or an EventGrid topic. For example, use + '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. :type scope: str - :param event_subscription_name: Name of the event subscription. Event - subscription names must be between 3 and 64 characters in length and - should use alphanumeric letters only. + :param event_subscription_name: Name of the event subscription. Event subscription names must + be between 3 and 64 characters in length and should use alphanumeric letters only. :type event_subscription_name: str - :param event_subscription_info: Event subscription properties - containing the destination and filter information. - :type event_subscription_info: - ~azure.mgmt.eventgrid.models.EventSubscription - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param event_subscription_info: Event subscription properties containing the destination and + filter information. + :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - scope=scope, - event_subscription_name=event_subscription_name, - event_subscription_info=event_subscription_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + scope=scope, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _delete_initial( - self, scope, event_subscription_name, custom_headers=None, raw=False, **operation_config): + self, + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def delete( - self, scope, event_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def begin_delete( + self, + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete an event subscription. Delete an existing event subscription. - :param scope: The scope of the event subscription. The scope can be a - subscription, or a resource group, or a top level resource belonging - to a resource provider namespace, or an EventGrid topic. For example, - use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' @@ -284,164 +310,195 @@ def delete( :type scope: str :param event_subscription_name: Name of the event subscription. :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - scope=scope, - event_subscription_name=event_subscription_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + scope=scope, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _update_initial( - self, scope, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, **operation_config): + self, + scope, # type: str + event_subscription_name, # type: str + event_subscription_update_parameters, # type: "models.EventSubscriptionUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.EventSubscription" + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None + deserialized = self._deserialize('EventSubscription', pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, scope, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def begin_update( + self, + scope, # type: str + event_subscription_name, # type: str + event_subscription_update_parameters, # type: "models.EventSubscriptionUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.EventSubscription"] """Update an event subscription. Asynchronously updates an existing event subscription. - :param scope: The scope of existing event subscription. The scope can - be a subscription, or a resource group, or a top level resource - belonging to a resource provider namespace, or an EventGrid topic. For - example, use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and + :param scope: The scope of existing event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. :type scope: str - :param event_subscription_name: Name of the event subscription to be - updated. + :param event_subscription_name: Name of the event subscription to be updated. :type event_subscription_name: str - :param event_subscription_update_parameters: Updated event - subscription information. - :type event_subscription_update_parameters: - ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param event_subscription_update_parameters: Updated event subscription information. + :type event_subscription_update_parameters: ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - scope=scope, - event_subscription_name=event_subscription_name, - event_subscription_update_parameters=event_subscription_update_parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + scope=scope, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def get_full_url( - self, scope, event_subscription_name, custom_headers=None, raw=False, **operation_config): + self, + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.EventSubscriptionFullUrl" """Get full URL of an event subscription. Get the full endpoint URL for an event subscription. - :param scope: The scope of the event subscription. The scope can be a - subscription, or a resource group, or a top level resource belonging - to a resource provider namespace, or an EventGrid topic. For example, - use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and + :param scope: The scope of the event subscription. The scope can be a subscription, or a + resource group, or a top level resource belonging to a resource provider namespace, or an + EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' @@ -449,809 +506,806 @@ def get_full_url( :type scope: str :param event_subscription_name: Name of the event subscription. :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscriptionFullUrl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventSubscriptionFullUrl, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionFullUrl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get_full_url.metadata['url'] + url = self.get_full_url.metadata['url'] # type: ignore path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscriptionFullUrl', response) + deserialized = self._deserialize('EventSubscriptionFullUrl', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_full_url.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} + get_full_url.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore def list_global_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """Get an aggregated list of all global event subscriptions under an Azure - subscription. - - List all aggregated global event subscriptions under a specific Azure - subscription. - - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """Get an aggregated list of all global event subscriptions under an Azure subscription. + + List all aggregated global event subscriptions under a specific Azure subscription. + + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_global_by_subscription.metadata['url'] + url = self.list_global_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_global_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_global_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore def list_global_by_subscription_for_topic_type( - self, topic_type_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + topic_type_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] """List all global event subscriptions for a topic type. - List all global event subscriptions under an Azure subscription for a - topic type. + List all global event subscriptions under an Azure subscription for a topic type. :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_global_by_subscription_for_topic_type.metadata['url'] + url = self.list_global_by_subscription_for_topic_type.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_global_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_global_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore def list_global_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all global event subscriptions under an Azure subscription and - resource group. - - List all global event subscriptions under a specific Azure subscription - and resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """List all global event subscriptions under an Azure subscription and resource group. + + List all global event subscriptions under a specific Azure subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_global_by_resource_group.metadata['url'] + url = self.list_global_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_global_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_global_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore def list_global_by_resource_group_for_topic_type( - self, resource_group_name, topic_type_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all global event subscriptions under a resource group for a topic - type. - - List all global event subscriptions under a resource group for a - specific topic type. - - :param resource_group_name: The name of the resource group within the - user's subscription. + self, + resource_group_name, # type: str + topic_type_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """List all global event subscriptions under a resource group for a topic type. + + List all global event subscriptions under a resource group for a specific topic type. + + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_global_by_resource_group_for_topic_type.metadata['url'] + url = self.list_global_by_resource_group_for_topic_type.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_global_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_global_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore def list_regional_by_subscription( - self, location, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] """List all regional event subscriptions under an Azure subscription. - List all event subscriptions from the given location under a specific - Azure subscription. + List all event subscriptions from the given location under a specific Azure subscription. :param location: Name of the location. :type location: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_regional_by_subscription.metadata['url'] + url = self.list_regional_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_regional_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_regional_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore def list_regional_by_resource_group( - self, resource_group_name, location, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all regional event subscriptions under an Azure subscription and + self, + resource_group_name, # type: str + location, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """List all regional event subscriptions under an Azure subscription and resource group. + + List all event subscriptions from the given location under a specific Azure subscription and resource group. - List all event subscriptions from the given location under a specific - Azure subscription and resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param location: Name of the location. :type location: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_regional_by_resource_group.metadata['url'] + url = self.list_regional_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_regional_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_regional_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore def list_regional_by_subscription_for_topic_type( - self, location, topic_type_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all regional event subscriptions under an Azure subscription for a + self, + location, # type: str + topic_type_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """List all regional event subscriptions under an Azure subscription for a topic type. + + List all event subscriptions from the given location under a specific Azure subscription and topic type. - List all event subscriptions from the given location under a specific - Azure subscription and topic type. - :param location: Name of the location. :type location: str :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_regional_by_subscription_for_topic_type.metadata['url'] + url = self.list_regional_by_subscription_for_topic_type.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_regional_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_regional_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore def list_regional_by_resource_group_for_topic_type( - self, resource_group_name, location, topic_type_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all regional event subscriptions under an Azure subscription and - resource group for a topic type. - - List all event subscriptions from the given location under a specific - Azure subscription and resource group and topic type. - - :param resource_group_name: The name of the resource group within the - user's subscription. + self, + resource_group_name, # type: str + location, # type: str + topic_type_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] + """List all regional event subscriptions under an Azure subscription and resource group for a topic type. + + List all event subscriptions from the given location under a specific Azure subscription and + resource group and topic type. + + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param location: Name of the location. :type location: str :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_regional_by_resource_group_for_topic_type.metadata['url'] + url = self.list_regional_by_resource_group_for_topic_type.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_regional_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_regional_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore def list_by_resource( - self, resource_group_name, provider_namespace, resource_type_name, resource_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + provider_namespace, # type: str + resource_type_name, # type: str + resource_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] """List all event subscriptions for a specific topic. - List all event subscriptions that have been created for a specific - topic. + List all event subscriptions that have been created for a specific topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param provider_namespace: Namespace of the provider of the topic. :type provider_namespace: str @@ -1259,183 +1313,179 @@ def list_by_resource( :type resource_type_name: str :param resource_name: Name of the resource. :type resource_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource.metadata['url'] + url = self.list_by_resource.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore def list_by_domain_topic( - self, resource_group_name, domain_name, topic_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + domain_name, # type: str + topic_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventSubscriptionsListResult"] """List all event subscriptions for a specific domain topic. - List all event subscriptions that have been created for a specific - domain topic. + List all event subscriptions that have been created for a specific domain topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param domain_name: Name of the top level domain. :type domain_name: str :param topic_name: Name of the domain topic. :type topic_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventSubscriptionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_domain_topic.metadata['url'] + url = self.list_by_domain_topic.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_domain_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'} + return ItemPaged( + get_next, extract_data + ) + list_by_domain_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py deleted file mode 100644 index 1187598fafbb..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py +++ /dev/null @@ -1,106 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class ExtensionTopicsOperations(object): - """ExtensionTopicsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, scope, custom_headers=None, raw=False, **operation_config): - """Get properties of an extension topic. - - Get the properties of an extension topic. - - :param scope: The identifier of the resource to which extension topic - is queried. The scope can be a subscription, or a resource group, or a - top level resource belonging to a resource provider namespace. For - example, use '/subscriptions/{subscriptionId}/' for a subscription, - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - for a resource group, and - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' - for Azure resource. - :type scope: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ExtensionTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ExtensionTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py index 476428ba25b3..597e80a31def 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py @@ -1,105 +1,111 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationsListResult"] """List available operations. - List the available operations supported by the Microsoft.EventGrid - resource provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.eventgrid.models.OperationPaged[~azure.mgmt.eventgrid.models.Operation] - :raises: :class:`CloudError` + List the available operations supported by the Microsoft.EventGrid resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.OperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.EventGrid/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.EventGrid/operations'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py deleted file mode 100644 index 4195f26749c5..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py +++ /dev/null @@ -1,713 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class PartnerNamespacesOperations(object): - """PartnerNamespacesOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): - """Get a partner namespace. - - Get properties of a partner namespace. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerNamespace or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} - - - def _create_or_update_initial( - self, resource_group_name, partner_namespace_name, partner_namespace_info, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(partner_namespace_info, 'PartnerNamespace') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PartnerNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, partner_namespace_name, partner_namespace_info, custom_headers=None, raw=False, polling=True, **operation_config): - """Create a partner namespace. - - Asynchronously creates a new partner namespace with the specified - parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param partner_namespace_info: PartnerNamespace information. - :type partner_namespace_info: - ~azure.mgmt.eventgrid.models.PartnerNamespace - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns PartnerNamespace or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PartnerNamespace]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - partner_namespace_name=partner_namespace_name, - partner_namespace_info=partner_namespace_info, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('PartnerNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} - - - def _delete_initial( - self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete a partner namespace. - - Delete existing partner namespace. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - partner_namespace_name=partner_namespace_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} - - - def _update_initial( - self, resource_group_name, partner_namespace_name, tags=None, custom_headers=None, raw=False, **operation_config): - partner_namespace_update_parameters = models.PartnerNamespaceUpdateParameters(tags=tags) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(partner_namespace_update_parameters, 'PartnerNamespaceUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PartnerNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, partner_namespace_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Update a partner namespace. - - Asynchronously updates a partner namespace with the specified - parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param tags: Tags of the partner namespace. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns PartnerNamespace or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PartnerNamespace]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - partner_namespace_name=partner_namespace_name, - tags=tags, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('PartnerNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} - - def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner namespaces under an Azure subscription. - - List all the partner namespaces under an Azure subscription. - - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerNamespace - :rtype: - ~azure.mgmt.eventgrid.models.PartnerNamespacePaged[~azure.mgmt.eventgrid.models.PartnerNamespace] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces'} - - def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner namespaces under a resource group. - - List all the partner namespaces under a resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerNamespace - :rtype: - ~azure.mgmt.eventgrid.models.PartnerNamespacePaged[~azure.mgmt.eventgrid.models.PartnerNamespace] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces'} - - def list_shared_access_keys( - self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): - """List keys for a partner namespace. - - List the two keys used to publish to a partner namespace. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerNamespaceSharedAccessKeys or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.list_shared_access_keys.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerNamespaceSharedAccessKeys', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys'} - - def regenerate_key( - self, resource_group_name, partner_namespace_name, key_name, custom_headers=None, raw=False, **operation_config): - """Regenerate key for a partner namespace. - - Regenerate a shared access key for a partner namespace. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_namespace_name: Name of the partner namespace. - :type partner_namespace_name: str - :param key_name: Key name to regenerate (key1 or key2). - :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerNamespaceSharedAccessKeys or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - regenerate_key_request = models.PartnerNamespaceRegenerateKeyRequest(key_name=key_name) - - # Construct URL - url = self.regenerate_key.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_key_request, 'PartnerNamespaceRegenerateKeyRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerNamespaceSharedAccessKeys', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py deleted file mode 100644 index 9bd6e57dfd24..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py +++ /dev/null @@ -1,545 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class PartnerRegistrationsOperations(object): - """PartnerRegistrationsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, partner_registration_name, custom_headers=None, raw=False, **operation_config): - """Get a partner registration. - - Gets a partner registration with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_registration_name: Name of the partner registration. - :type partner_registration_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerRegistration or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerRegistration', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} - - def create_or_update( - self, resource_group_name, partner_registration_name, partner_registration_info, custom_headers=None, raw=False, **operation_config): - """Create a partner registration. - - Creates a new partner registration with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_registration_name: Name of the partner registration. - :type partner_registration_name: str - :param partner_registration_info: PartnerRegistration information. - :type partner_registration_info: - ~azure.mgmt.eventgrid.models.PartnerRegistration - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerRegistration or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(partner_registration_info, 'PartnerRegistration') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerRegistration', response) - if response.status_code == 202: - deserialized = self._deserialize('PartnerRegistration', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} - - def delete( - self, resource_group_name, partner_registration_name, custom_headers=None, raw=False, **operation_config): - """Delete a partner registration. - - Deletes a partner registration with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_registration_name: Name of the partner registration. - :type partner_registration_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} - - def update( - self, resource_group_name, partner_registration_name, partner_registration_update_parameters, custom_headers=None, raw=False, **operation_config): - """Update a partner registration. - - Updates a partner registration with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_registration_name: Name of the partner registration. - :type partner_registration_name: str - :param partner_registration_update_parameters: Partner registration - update information. - :type partner_registration_update_parameters: - ~azure.mgmt.eventgrid.models.PartnerRegistrationUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerRegistration or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(partner_registration_update_parameters, 'PartnerRegistrationUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('PartnerRegistration', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} - - def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner registrations under an Azure subscription. - - List all the partner registrations under an Azure subscription. - - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerRegistration - :rtype: - ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations'} - - def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner registrations under a resource group. - - List all the partner registrations under a resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerRegistration - :rtype: - ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations'} - - def list( - self, custom_headers=None, raw=False, **operation_config): - """List all available partners registrations. - - List all partners registrations. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerRegistration - :rtype: - ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/providers/Microsoft.EventGrid/partnerRegistrations'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py deleted file mode 100644 index 04110282b68d..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py +++ /dev/null @@ -1,585 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class PartnerTopicEventSubscriptionsOperations(object): - """PartnerTopicEventSubscriptionsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get an event subscription of a partner topic. - - Get an event subscription of a partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param event_subscription_name: Name of the event subscription to be - found. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscription or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscription or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _create_or_update_initial( - self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, polling=True, **operation_config): - """Create or update an event subscription of a partner topic. - - Asynchronously creates or updates an event subscription of a partner - topic with the specified parameters. Existing event subscriptions will - be updated with this API. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param event_subscription_info: Event subscription properties - containing the destination and filter information. - :type event_subscription_info: - ~azure.mgmt.eventgrid.models.EventSubscription - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - partner_topic_name=partner_topic_name, - event_subscription_name=event_subscription_name, - event_subscription_info=event_subscription_info, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _delete_initial( - self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete an event subscription of a partner topic. - - Delete an event subscription of a partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - partner_topic_name=partner_topic_name, - event_subscription_name=event_subscription_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _update_initial( - self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Update event subscription of a partner topic. - - Update event subscription of a partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param event_subscription_update_parameters: Updated event - subscription information. - :type event_subscription_update_parameters: - ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - partner_topic_name=partner_topic_name, - event_subscription_name=event_subscription_name, - event_subscription_update_parameters=event_subscription_update_parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - def get_full_url( - self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get full URL of an event subscription of a partner topic. - - Get the full endpoint URL for an event subscription of a partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscriptionFullUrl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get_full_url.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscriptionFullUrl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} - - def list_by_partner_topic( - self, resource_group_name, partner_topic_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List event subscriptions of a partner topic. - - List event subscriptions that belong to a specific partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_partner_topic.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_partner_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py deleted file mode 100644 index 763b8d9bdce2..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py +++ /dev/null @@ -1,564 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class PartnerTopicsOperations(object): - """PartnerTopicsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): - """Get a partner topic. - - Get properties of a partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} - - - def _delete_initial( - self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete a partner topic. - - Delete existing partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - partner_topic_name=partner_topic_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} - - def update( - self, resource_group_name, partner_topic_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Update a partner topic. - - Asynchronously updates a partner topic with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param tags: Tags of the partner topic. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - partner_topic_update_parameters = models.PartnerTopicUpdateParameters(tags=tags) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(partner_topic_update_parameters, 'PartnerTopicUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('PartnerTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} - - def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner topics under an Azure subscription. - - List all the partner topics under an Azure subscription. - - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerTopic - :rtype: - ~azure.mgmt.eventgrid.models.PartnerTopicPaged[~azure.mgmt.eventgrid.models.PartnerTopic] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics'} - - def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List partner topics under a resource group. - - List all the partner topics under a resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PartnerTopic - :rtype: - ~azure.mgmt.eventgrid.models.PartnerTopicPaged[~azure.mgmt.eventgrid.models.PartnerTopic] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PartnerTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics'} - - def activate( - self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): - """Activate a partner topic. - - Activate a newly created partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.activate.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate'} - - def deactivate( - self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): - """Deactivate a partner topic. - - Deactivate specific partner topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param partner_topic_name: Name of the partner topic. - :type partner_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PartnerTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.deactivate.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PartnerTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py index 253fc8db2222..901e48d6f3b1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py @@ -1,425 +1,480 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum14"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" """Get a specific private endpoint connection. Get a specific private endpoint connection under a topic or domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. - :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum14 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection connection. + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _update_initial( - self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, private_endpoint_connection, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum15"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, private_endpoint_connection, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum15"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.PrivateEndpointConnection"] """Update a specific private endpoint connection. Update a specific private endpoint connection under a topic or domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. - :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum15 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection connection. + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection - object to update. - :type private_endpoint_connection: - ~azure.mgmt.eventgrid.models.PrivateEndpointConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param private_endpoint_connection: The private endpoint connection object to update. + :type private_endpoint_connection: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - PrivateEndpointConnection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PrivateEndpointConnection]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - parent_type=parent_type, - parent_name=parent_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('PrivateEndpointConnection', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( - self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum16"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum16"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete a specific private endpoint connection. Delete a specific private endpoint connection under a topic or domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. - :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum16 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection connection. + :param private_endpoint_connection_name: The name of the private endpoint connection + connection. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - parent_type=parent_type, - parent_name=parent_name, - private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def list_by_resource( - self, resource_group_name, parent_type, parent_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: Union[str, "models.Enum17"] + parent_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] """Lists all private endpoint connections under a resource. Get all private endpoint connections under a topic or domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. - :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.Enum17 + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateEndpointConnection - :rtype: - ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource.metadata['url'] + url = self.list_by_resource.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str') + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py index 6500b3252ee9..d2a0f56ab790 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py @@ -1,210 +1,217 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, parent_type, parent_name, private_link_resource_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: str + parent_name, # type: str + private_link_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateLinkResource" """Get a private link resource. Get properties of a private link resource. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str :param private_link_resource_name: The name of private link resource. :type private_link_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateLinkResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str') + 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateLinkResource', response) + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore def list_by_resource( - self, resource_group_name, parent_type, parent_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + parent_type, # type: str + parent_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateLinkResourcesListResult"] """List private link resources under specific topic or domain. List all the private link resources under a topic or domain. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param parent_type: The type of the parent resource. This can be - either \\'topics\\' or \\'domains\\'. + :param parent_type: The type of the parent resource. This can be either \'topics\' or + \'domains\'. :type parent_type: str - :param parent_name: The name of the parent resource (namely, either, - the topic name or domain name). + :param parent_name: The name of the parent resource (namely, either, the topic name or domain + name). :type parent_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateLinkResource - :rtype: - ~azure.mgmt.eventgrid.models.PrivateLinkResourcePaged[~azure.mgmt.eventgrid.models.PrivateLinkResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource.metadata['url'] + url = self.list_by_resource.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str') + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PrivateLinkResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py deleted file mode 100644 index bfa03f260133..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py +++ /dev/null @@ -1,585 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class SystemTopicEventSubscriptionsOperations(object): - """SystemTopicEventSubscriptionsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get an event subscription of a system topic. - - Get an event subscription. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscription or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscription or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _create_or_update_initial( - self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, polling=True, **operation_config): - """Create or update an event subscription for a system topic. - - Asynchronously creates or updates an event subscription with the - specified parameters. Existing event subscriptions will be updated with - this API. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param event_subscription_info: Event subscription properties - containing the destination and filter information. - :type event_subscription_info: - ~azure.mgmt.eventgrid.models.EventSubscription - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - event_subscription_name=event_subscription_name, - event_subscription_info=event_subscription_info, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _delete_initial( - self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete an event subscription of a system topic. - - Delete an event subscription of a system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - event_subscription_name=event_subscription_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - - def _update_initial( - self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Update event subscription of a system topic. - - Update event subscription of a system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param event_subscription_update_parameters: Updated event - subscription information. - :type event_subscription_update_parameters: - ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns EventSubscription or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - event_subscription_name=event_subscription_name, - event_subscription_update_parameters=event_subscription_update_parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('EventSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} - - def get_full_url( - self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get full URL of an event subscription of a system topic. - - Get the full endpoint URL for an event subscription of a system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param event_subscription_name: Name of the event subscription to be - created. Event subscription names must be between 3 and 100 characters - in length and use alphanumeric letters only. - :type event_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EventSubscriptionFullUrl or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get_full_url.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EventSubscriptionFullUrl', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} - - def list_by_system_topic( - self, resource_group_name, system_topic_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List event subscriptions of a system topic. - - List event subscriptions that belong to a specific system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventSubscription - :rtype: - ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_system_topic.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_system_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py deleted file mode 100644 index 1d9b4643522f..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py +++ /dev/null @@ -1,577 +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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class SystemTopicsOperations(object): - """SystemTopicsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config - - def get( - self, resource_group_name, system_topic_name, custom_headers=None, raw=False, **operation_config): - """Get a system topic. - - Get properties of a system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SystemTopic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.SystemTopic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SystemTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} - - - def _create_or_update_initial( - self, resource_group_name, system_topic_name, system_topic_info, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_or_update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(system_topic_info, 'SystemTopic') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SystemTopic', response) - if response.status_code == 201: - deserialized = self._deserialize('SystemTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update( - self, resource_group_name, system_topic_name, system_topic_info, custom_headers=None, raw=False, polling=True, **operation_config): - """Create a system topic. - - Asynchronously creates a new system topic with the specified - parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param system_topic_info: System Topic information. - :type system_topic_info: ~azure.mgmt.eventgrid.models.SystemTopic - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns SystemTopic or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.SystemTopic] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.SystemTopic]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - system_topic_info=system_topic_info, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('SystemTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} - - - def _delete_initial( - self, resource_group_name, system_topic_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, system_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete a system topic. - - Delete existing system topic. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} - - - def _update_initial( - self, resource_group_name, system_topic_name, tags=None, custom_headers=None, raw=False, **operation_config): - system_topic_update_parameters = models.SystemTopicUpdateParameters(tags=tags) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SystemTopic', response) - if response.status_code == 201: - deserialized = self._deserialize('SystemTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, system_topic_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Update a system topic. - - Asynchronously updates a system topic with the specified parameters. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param system_topic_name: Name of the system topic. - :type system_topic_name: str - :param tags: Tags of the system topic. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns SystemTopic or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.SystemTopic] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.SystemTopic]] - :raises: :class:`CloudError` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - system_topic_name=system_topic_name, - tags=tags, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('SystemTopic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} - - def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List system topics under an Azure subscription. - - List all the system topics under an Azure subscription. - - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SystemTopic - :rtype: - ~azure.mgmt.eventgrid.models.SystemTopicPaged[~azure.mgmt.eventgrid.models.SystemTopic] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SystemTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics'} - - def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): - """List system topics under a resource group. - - List all the system topics under a resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. - :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. - :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SystemTopic - :rtype: - ~azure.mgmt.eventgrid.models.SystemTopicPaged[~azure.mgmt.eventgrid.models.SystemTopic] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SystemTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py index c9222e00b384..ed62bcb0a621 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py @@ -1,233 +1,239 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class TopicTypesOperations(object): """TopicTypesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopicTypesListResult"] """List topic types. List all registered topic types. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of TopicTypeInfo - :rtype: - ~azure.mgmt.eventgrid.models.TopicTypeInfoPaged[~azure.mgmt.eventgrid.models.TopicTypeInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicTypesListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.TopicTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopicTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopicTypeInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes'} # type: ignore def get( - self, topic_type_name, custom_headers=None, raw=False, **operation_config): + self, + topic_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopicTypeInfo" """Get a topic type. Get information about a topic type. :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopicTypeInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicTypeInfo, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicTypeInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TopicTypeInfo', response) + deserialized = self._deserialize('TopicTypeInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}'} + get.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}'} # type: ignore def list_event_types( - self, topic_type_name, custom_headers=None, raw=False, **operation_config): + self, + topic_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventTypesListResult"] """List event types. List event types for a topic type. :param topic_type_name: Name of the topic type. :type topic_type_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventType - :rtype: - ~azure.mgmt.eventgrid.models.EventTypePaged[~azure.mgmt.eventgrid.models.EventType] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_event_types.metadata['url'] + url = self.list_event_types.metadata['url'] # type: ignore path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str') + 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventTypePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_event_types.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes'} + return ItemPaged( + get_next, extract_data + ) + list_event_types.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py index 636333df52a3..2086a6574350 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py @@ -1,719 +1,785 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class TopicsOperations(object): """TopicsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.eventgrid.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-04-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Topic" """Get a topic. Get properties of a topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Topic or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.Topic or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Topic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Topic + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Topic', response) + deserialized = self._deserialize('Topic', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, topic_name, topic_info, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + topic_info, # type: "models.Topic" + **kwargs # type: Any + ): + # type: (...) -> "models.Topic" + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(topic_info, 'Topic') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(topic_info, 'Topic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('Topic', response) + deserialized = self._deserialize('Topic', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, topic_name, topic_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + topic_name, # type: str + topic_info, # type: "models.Topic" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Topic"] """Create a topic. Asynchronously creates a new topic with the specified parameters. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str :param topic_info: Topic information. :type topic_info: ~azure.mgmt.eventgrid.models.Topic - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Topic or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.Topic] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.Topic]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Topic or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Topic] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - topic_name=topic_name, - topic_info=topic_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Topic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + topic_info=topic_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def _delete_initial( - self, resource_group_name, topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def delete( - self, resource_group_name, topic_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete a topic. Delete existing topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - topic_name=topic_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def _update_initial( - self, resource_group_name, topic_name, topic_update_parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + topic_update_parameters, # type: "models.TopicUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Topic"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Topic"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('Topic', response) + deserialized = self._deserialize('Topic', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, topic_name, topic_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + topic_name, # type: str + topic_update_parameters, # type: "models.TopicUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Topic"] """Update a topic. Asynchronously updates a topic with the specified parameters. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str :param topic_update_parameters: Topic update information. - :type topic_update_parameters: - ~azure.mgmt.eventgrid.models.TopicUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :type topic_update_parameters: ~azure.mgmt.eventgrid.models.TopicUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Topic or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.Topic] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.Topic]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - topic_name=topic_name, - topic_update_parameters=topic_update_parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Topic"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Topic', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + topic_update_parameters=topic_update_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Topic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def list_by_subscription( - self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopicsListResult"] """List topics under an Azure subscription. List all the topics under an Azure subscription. - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Topic - :rtype: - ~azure.mgmt.eventgrid.models.TopicPaged[~azure.mgmt.eventgrid.models.Topic] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.TopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopicPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'} # type: ignore def list_by_resource_group( - self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.TopicsListResult"] """List topics under a resource group. List all the topics under a resource group. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str - :param filter: The query used to filter the search results using OData - syntax. Filtering is permitted on the 'name' property only and with - limited number of OData operations. These operations are: the - 'contains' function as well as the following logical operations: not, - and, or, eq (for equal), and ne (for not equal). No arithmetic - operations are supported. The following is a valid filter example: - $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The - following is not a valid filter example: $filter=location eq 'westus'. + :param filter: The query used to filter the search results using OData syntax. Filtering is + permitted on the 'name' property only and with limited number of OData operations. These + operations are: the 'contains' function as well as the following logical operations: not, and, + or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The + following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. + The following is not a valid filter example: $filter=location eq 'westus'. :type filter: str - :param top: The number of results to return per page for the list - operation. Valid range for top parameter is 1 to 100. If not - specified, the default number of results to be returned is 20 items - per page. + :param top: The number of results to return per page for the list operation. Valid range for + top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 + items per page. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Topic - :rtype: - ~azure.mgmt.eventgrid.models.TopicPaged[~azure.mgmt.eventgrid.models.Topic] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.TopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') if top is not None: query_parameters['$top'] = self._serialize.query("top", top, 'int') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TopicsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'} # type: ignore def list_shared_access_keys( - self, resource_group_name, topic_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopicSharedAccessKeys" """List keys for a topic. List the two keys used to publish to a topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopicSharedAccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + # Construct URL - url = self.list_shared_access_keys.metadata['url'] + url = self.list_shared_access_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TopicSharedAccessKeys', response) + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'} + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'} # type: ignore def regenerate_key( - self, resource_group_name, topic_name, key_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + topic_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.TopicSharedAccessKeys" """Regenerate key for a topic. Regenerate a shared access key for a topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param topic_name: Name of the topic. :type topic_name: str - :param key_name: Key name to regenerate key1 or key2 + :param key_name: Key name to regenerate key1 or key2. :type key_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TopicSharedAccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_key_request = models.TopicRegenerateKeyRequest(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.TopicSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _regenerate_key_request = models.TopicRegenerateKeyRequest(key_name=key_name) + api_version = "2020-06-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_key.metadata['url'] + url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str') + 'topicName': self._serialize.url("topic_name", topic_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_key_request, 'TopicRegenerateKeyRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_regenerate_key_request, 'TopicRegenerateKeyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TopicSharedAccessKeys', response) + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore def list_event_types( - self, resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + provider_namespace, # type: str + resource_type_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.EventTypesListResult"] """List topic event types. List event types for a topic. - :param resource_group_name: The name of the resource group within the - user's subscription. + :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str :param provider_namespace: Namespace of the provider of the topic. :type provider_namespace: str @@ -721,68 +787,66 @@ def list_event_types( :type resource_type_name: str :param resource_name: Name of the topic. :type resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of EventType - :rtype: - ~azure.mgmt.eventgrid.models.EventTypePaged[~azure.mgmt.eventgrid.models.EventType] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.EventTypesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_event_types.metadata['url'] + url = self.list_event_types.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('EventTypesListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EventTypePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_event_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes'} + return ItemPaged( + get_next, extract_data + ) + list_event_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/py.typed b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py index 8ff291500f8c..75c8055b91ec 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') +with open(os.path.join(package_folder_path, '_version.py') if os.path.exists(os.path.join(package_folder_path, 'version.py')) else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', @@ -81,8 +81,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0' ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml new file mode 100644 index 000000000000..d0a0983a576b --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml @@ -0,0 +1,390 @@ +interactions: +- request: + body: '{"location": "westus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '{"properties":{"provisioningState":"Creating","endpoint":null},"location":"westus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + headers: + azure-asyncoperation: + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/D703D5E6-7C9C-4312-BBAF-1F33B063F75F?api-version=2020-06-01 + cache-control: + - no-cache + content-length: + - '315' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/D703D5E6-7C9C-4312-BBAF-1F33B063F75F?api-version=2020-06-01 + response: + body: + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/D703D5E6-7C9C-4312-BBAF-1F33B063F75F?api-version=2020-06-01","name":"d703d5e6-7c9c-4312-bbaf-1f33b063f75f","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '279' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:26 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.westus-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"e81b8a8f-987e-47c5-b59f-34d73872a8ed","publicNetworkAccess":"Enabled"},"location":"westus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + headers: + cache-control: + - no-cache + content-length: + - '498' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:26 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"tags": {"tag1": "value1", "tag2": "value2"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '46' + Content-Type: + - application/json + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '{"properties":{"provisioningState":"Updating","endpoint":"https://domain70eb095d.westus-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"e81b8a8f-987e-47c5-b59f-34d73872a8ed","publicNetworkAccess":"Enabled"},"location":"westus","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + headers: + azure-asyncoperation: + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/E671AD99-24A2-4CD0-A891-1E688BBA525D?api-version=2020-06-01 + cache-control: + - no-cache + content-length: + - '526' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:29 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/E671AD99-24A2-4CD0-A891-1E688BBA525D?api-version=2020-06-01 + response: + body: + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/E671AD99-24A2-4CD0-A891-1E688BBA525D?api-version=2020-06-01","name":"e671ad99-24a2-4cd0-a891-1e688bba525d","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '279' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.westus-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"e81b8a8f-987e-47c5-b59f-34d73872a8ed","publicNetworkAccess":"Enabled"},"location":"westus","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + headers: + cache-control: + - no-cache + content-length: + - '527' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.westus-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"e81b8a8f-987e-47c5-b59f-34d73872a8ed","publicNetworkAccess":"Enabled"},"location":"westus","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + headers: + cache-control: + - no-cache + content-length: + - '527' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_domain_test_domain70eb095d/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2020-06-01 + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/752B97CD-3A6A-4E28-A693-8B6601849484?api-version=2020-06-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 27 Oct 2020 08:49:40 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationResults/752B97CD-3A6A-4E28-A693-8B6601849484?api-version=2020-06-01 + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-mgmt-eventgrid/8.0.0b1 Python/3.6.9 (Linux-4.19.76-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/752B97CD-3A6A-4E28-A693-8B6601849484?api-version=2020-06-01 + response: + body: + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/westus/operationsStatus/752B97CD-3A6A-4E28-A693-8B6601849484?api-version=2020-06-01","name":"752b97cd-3a6a-4e28-a693-8b6601849484","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '279' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 27 Oct 2020 08:49:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/tests/test_domain.py b/sdk/eventgrid/azure-mgmt-eventgrid/tests/test_domain.py new file mode 100644 index 000000000000..53313b084298 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/tests/test_domain.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import unittest + +from azure.mgmt.eventgrid import EventGridManagementClient + +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + + +class MgmtEventGridTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtEventGridTest, self).setUp() + self.eventgrid_client = self.create_mgmt_client(EventGridManagementClient) + + @ResourceGroupPreparer() + def test_domain(self, resource_group, location): + # create + DOMAIN_NAME = self.get_resource_name('domain') + BODY = { + "location": location + } + result = self.eventgrid_client.domains.begin_create_or_update(resource_group.name, DOMAIN_NAME, BODY) + result.result() + + # update + BODY = { + "tags": { + "tag1": "value1", + "tag2": "value2" + } + } + result = self.eventgrid_client.domains.begin_update(resource_group.name, DOMAIN_NAME, BODY) + result.result() + + # get + self.eventgrid_client.domains.get(resource_group.name, DOMAIN_NAME) + + # delete + result = self.eventgrid_client.domains.begin_delete(resource_group.name, DOMAIN_NAME) + result.result() + + +# ------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main()