From 0e93c6a91f99311c6ba0fd93f5db6adbdc6982ce Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 7 Apr 2022 10:43:38 +0800 Subject: [PATCH] [AutoRelease] t2-eventgrid-2022-03-28-97024(Do not merge) (#23692) * code and test * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines Co-authored-by: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com> Co-authored-by: Yuchao Yan --- .../azure-mgmt-eventgrid/CHANGELOG.md | 28 + sdk/eventgrid/azure-mgmt-eventgrid/_meta.json | 4 +- .../azure/mgmt/eventgrid/_configuration.py | 15 +- .../_event_grid_management_client.py | 73 +- .../azure/mgmt/eventgrid/_metadata.json | 20 +- .../azure/mgmt/eventgrid/_version.py | 2 +- .../mgmt/eventgrid/aio/_configuration.py | 2 +- .../aio/_event_grid_management_client.py | 51 +- .../mgmt/eventgrid/aio/operations/__init__.py | 28 +- .../aio/operations/_channels_operations.py | 490 +++ .../_domain_event_subscriptions_operations.py | 660 +++ ...in_topic_event_subscriptions_operations.py | 694 +++ .../operations/_event_channels_operations.py | 369 ++ .../_event_subscriptions_operations.py | 4 +- .../_partner_configurations_operations.py | 693 +++ .../_partner_destinations_operations.py | 555 +++ .../_partner_namespaces_operations.py | 726 +++ .../_partner_registrations_operations.py | 616 +++ ...er_topic_event_subscriptions_operations.py | 684 +++ .../operations/_partner_topics_operations.py | 608 +++ ...private_endpoint_connections_operations.py | 60 +- .../_private_link_resources_operations.py | 20 +- ...em_topic_event_subscriptions_operations.py | 4 +- .../_topic_event_subscriptions_operations.py | 660 +++ .../aio/operations/_topics_operations.py | 10 +- .../_verified_partners_operations.py | 177 + .../azure/mgmt/eventgrid/models/__init__.py | 389 +- .../_event_grid_management_client_enums.py | 205 +- .../azure/mgmt/eventgrid/models/_models.py | 3884 ----------------- .../mgmt/eventgrid/models/_models_py3.py | 2869 +++++++++++- .../mgmt/eventgrid/operations/__init__.py | 28 +- .../operations/_channels_operations.py | 728 +++ .../_domain_event_subscriptions_operations.py | 930 ++++ ...in_topic_event_subscriptions_operations.py | 978 +++++ .../operations/_domain_topics_operations.py | 144 +- .../operations/_domains_operations.py | 249 +- .../operations/_event_channels_operations.py | 526 +++ .../_event_subscriptions_operations.py | 500 +-- .../_extension_topics_operations.py | 28 +- .../mgmt/eventgrid/operations/_operations.py | 24 +- .../_partner_configurations_operations.py | 994 +++++ .../_partner_destinations_operations.py | 822 ++++ .../_partner_namespaces_operations.py | 1035 +++++ .../_partner_registrations_operations.py | 848 ++++ ...er_topic_event_subscriptions_operations.py | 961 ++++ .../operations/_partner_topics_operations.py | 908 ++++ ...private_endpoint_connections_operations.py | 222 +- .../_private_link_resources_operations.py | 100 +- ...em_topic_event_subscriptions_operations.py | 256 +- .../operations/_system_topics_operations.py | 198 +- .../_topic_event_subscriptions_operations.py | 930 ++++ .../operations/_topic_types_operations.py | 56 +- .../operations/_topics_operations.py | 298 +- .../_verified_partners_operations.py | 240 + ...domain.pyTestMgmtEventGridtest_domain.json | 194 +- shared_requirements.txt | 1 + 56 files changed, 21275 insertions(+), 5523 deletions(-) create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_channels_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py delete mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py create mode 100644 sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md index dbd07c142828..e8bb85b4cebc 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 10.2.0b1 (2022-04-07) + +**Features** + + - Added operation group ChannelsOperations + - Added operation group DomainEventSubscriptionsOperations + - Added operation group DomainTopicEventSubscriptionsOperations + - Added operation group EventChannelsOperations + - Added operation group PartnerConfigurationsOperations + - Added operation group PartnerDestinationsOperations + - Added operation group PartnerNamespacesOperations + - Added operation group PartnerRegistrationsOperations + - Added operation group PartnerTopicEventSubscriptionsOperations + - Added operation group PartnerTopicsOperations + - Added operation group TopicEventSubscriptionsOperations + - Added operation group VerifiedPartnersOperations + - Model Domain has a new parameter data_residency_boundary + - Model Domain has a new parameter sku + - Model DomainUpdateParameters has a new parameter data_residency_boundary + - Model DomainUpdateParameters has a new parameter sku + - Model Operation has a new parameter is_data_action + - Model Topic has a new parameter data_residency_boundary + - Model Topic has a new parameter extended_location + - Model Topic has a new parameter kind + - Model Topic has a new parameter sku + - Model TopicUpdateParameters has a new parameter data_residency_boundary + - Model TopicUpdateParameters has a new parameter sku + ## 10.1.0 (2021-12-13) **Features** diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json index 33c73c768de8..c1d503b74fba 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json @@ -4,8 +4,8 @@ "@autorest/python@5.12.0", "@autorest/modelerfour@4.19.3" ], - "commit": "f3477bd0a7b6101f9c0af243cc0106c7a8e24c71", + "commit": "dfb02eb8ee4f04974fc46e9708615bff03329907", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/eventgrid/resource-manager/readme.md" } \ No newline at end of file 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 a3549d2b8b08..4510f6d0a6e3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,8 +16,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,11 +33,10 @@ class EventGridManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: super(EventGridManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-01" + self.api_version = "2021-10-15-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-eventgrid/{}'.format(VERSION)) self._configure(**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 a716cbef1493..f954bfce1c3a 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 @@ -7,38 +7,61 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer from . import models from ._configuration import EventGridManagementClientConfiguration -from .operations import DomainTopicsOperations, DomainsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicTypesOperations, TopicsOperations +from .operations import ChannelsOperations, DomainEventSubscriptionsOperations, DomainTopicEventSubscriptionsOperations, DomainTopicsOperations, DomainsOperations, EventChannelsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PartnerConfigurationsOperations, PartnerDestinationsOperations, PartnerNamespacesOperations, PartnerRegistrationsOperations, PartnerTopicEventSubscriptionsOperations, PartnerTopicsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicEventSubscriptionsOperations, TopicTypesOperations, TopicsOperations, VerifiedPartnersOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class EventGridManagementClient(object): +class EventGridManagementClient: """Azure EventGrid Management Client. + :ivar channels: ChannelsOperations operations + :vartype channels: azure.mgmt.eventgrid.operations.ChannelsOperations :ivar domains: DomainsOperations operations :vartype domains: azure.mgmt.eventgrid.operations.DomainsOperations :ivar domain_topics: DomainTopicsOperations operations :vartype domain_topics: azure.mgmt.eventgrid.operations.DomainTopicsOperations + :ivar event_channels: EventChannelsOperations operations + :vartype event_channels: azure.mgmt.eventgrid.operations.EventChannelsOperations :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.operations.EventSubscriptionsOperations + :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations + :vartype domain_topic_event_subscriptions: + azure.mgmt.eventgrid.operations.DomainTopicEventSubscriptionsOperations + :ivar topic_event_subscriptions: TopicEventSubscriptionsOperations operations + :vartype topic_event_subscriptions: + azure.mgmt.eventgrid.operations.TopicEventSubscriptionsOperations + :ivar domain_event_subscriptions: DomainEventSubscriptionsOperations operations + :vartype domain_event_subscriptions: + azure.mgmt.eventgrid.operations.DomainEventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations + :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptionsOperations operations + :vartype partner_topic_event_subscriptions: + azure.mgmt.eventgrid.operations.PartnerTopicEventSubscriptionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.operations.Operations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations + :ivar partner_configurations: PartnerConfigurationsOperations operations + :vartype partner_configurations: + azure.mgmt.eventgrid.operations.PartnerConfigurationsOperations + :ivar partner_destinations: PartnerDestinationsOperations operations + :vartype partner_destinations: azure.mgmt.eventgrid.operations.PartnerDestinationsOperations + :ivar partner_namespaces: PartnerNamespacesOperations operations + :vartype partner_namespaces: azure.mgmt.eventgrid.operations.PartnerNamespacesOperations + :ivar partner_registrations: PartnerRegistrationsOperations operations + :vartype partner_registrations: azure.mgmt.eventgrid.operations.PartnerRegistrationsOperations + :ivar partner_topics: PartnerTopicsOperations operations + :vartype partner_topics: azure.mgmt.eventgrid.operations.PartnerTopicsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.eventgrid.operations.PrivateEndpointConnectionsOperations @@ -46,10 +69,14 @@ class EventGridManagementClient(object): :vartype private_link_resources: azure.mgmt.eventgrid.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations :vartype system_topics: azure.mgmt.eventgrid.operations.SystemTopicsOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations :ivar extension_topics: ExtensionTopicsOperations operations :vartype extension_topics: azure.mgmt.eventgrid.operations.ExtensionTopicsOperations :ivar topic_types: TopicTypesOperations operations :vartype topic_types: azure.mgmt.eventgrid.operations.TopicTypesOperations + :ivar verified_partners: VerifiedPartnersOperations operations + :vartype verified_partners: azure.mgmt.eventgrid.operations.VerifiedPartnersOperations :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 @@ -63,12 +90,11 @@ class EventGridManagementClient(object): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url="https://management.azure.com", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: self._config = EventGridManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -76,25 +102,36 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) 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_channels = EventChannelsOperations(self._client, self._config, self._serialize, self._deserialize) self.event_subscriptions = EventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.topic_event_subscriptions = TopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_event_subscriptions = DomainEventSubscriptionsOperations(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.partner_configurations = PartnerConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.partner_destinations = PartnerDestinationsOperations(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.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.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.topic_types = TopicTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.verified_partners = VerifiedPartnersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json index f21a2d17a6b8..5c9f1e5f3c69 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-12-01", - "total_api_version_list": ["2021-12-01"], + "chosen_version": "2021-10-15-preview", + "total_api_version_list": ["2021-10-15-preview"], "client": { "name": "EventGridManagementClient", "filename": "_event_grid_management_client", @@ -97,16 +97,28 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { + "channels": "ChannelsOperations", "domains": "DomainsOperations", "domain_topics": "DomainTopicsOperations", + "event_channels": "EventChannelsOperations", "event_subscriptions": "EventSubscriptionsOperations", + "domain_topic_event_subscriptions": "DomainTopicEventSubscriptionsOperations", + "topic_event_subscriptions": "TopicEventSubscriptionsOperations", + "domain_event_subscriptions": "DomainEventSubscriptionsOperations", "system_topic_event_subscriptions": "SystemTopicEventSubscriptionsOperations", + "partner_topic_event_subscriptions": "PartnerTopicEventSubscriptionsOperations", "operations": "Operations", - "topics": "TopicsOperations", + "partner_configurations": "PartnerConfigurationsOperations", + "partner_destinations": "PartnerDestinationsOperations", + "partner_namespaces": "PartnerNamespacesOperations", + "partner_registrations": "PartnerRegistrationsOperations", + "partner_topics": "PartnerTopicsOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "private_link_resources": "PrivateLinkResourcesOperations", "system_topics": "SystemTopicsOperations", + "topics": "TopicsOperations", "extension_topics": "ExtensionTopicsOperations", - "topic_types": "TopicTypesOperations" + "topic_types": "TopicTypesOperations", + "verified_partners": "VerifiedPartnersOperations" } } \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py index c1257f7f4e11..a1e5cf8bc16e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.1.0" +VERSION = "10.2.0b1" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py index cab82dd107c4..254fe48444c4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-01" + self.api_version = "2021-10-15-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-eventgrid/{}'.format(VERSION)) self._configure(**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 index 9d68649ac893..f55b2f41a2e5 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py @@ -15,7 +15,7 @@ from .. import models from ._configuration import EventGridManagementClientConfiguration -from .operations import DomainTopicsOperations, DomainsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicTypesOperations, TopicsOperations +from .operations import ChannelsOperations, DomainEventSubscriptionsOperations, DomainTopicEventSubscriptionsOperations, DomainTopicsOperations, DomainsOperations, EventChannelsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PartnerConfigurationsOperations, PartnerDestinationsOperations, PartnerNamespacesOperations, PartnerRegistrationsOperations, PartnerTopicEventSubscriptionsOperations, PartnerTopicsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicEventSubscriptionsOperations, TopicTypesOperations, TopicsOperations, VerifiedPartnersOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -24,19 +24,46 @@ class EventGridManagementClient: """Azure EventGrid Management Client. + :ivar channels: ChannelsOperations operations + :vartype channels: azure.mgmt.eventgrid.aio.operations.ChannelsOperations :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_channels: EventChannelsOperations operations + :vartype event_channels: azure.mgmt.eventgrid.aio.operations.EventChannelsOperations :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.aio.operations.EventSubscriptionsOperations + :ivar domain_topic_event_subscriptions: DomainTopicEventSubscriptionsOperations operations + :vartype domain_topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.DomainTopicEventSubscriptionsOperations + :ivar topic_event_subscriptions: TopicEventSubscriptionsOperations operations + :vartype topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.TopicEventSubscriptionsOperations + :ivar domain_event_subscriptions: DomainEventSubscriptionsOperations operations + :vartype domain_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.DomainEventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.aio.operations.SystemTopicEventSubscriptionsOperations + :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptionsOperations operations + :vartype partner_topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.PartnerTopicEventSubscriptionsOperations :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 partner_configurations: PartnerConfigurationsOperations operations + :vartype partner_configurations: + azure.mgmt.eventgrid.aio.operations.PartnerConfigurationsOperations + :ivar partner_destinations: PartnerDestinationsOperations operations + :vartype partner_destinations: + azure.mgmt.eventgrid.aio.operations.PartnerDestinationsOperations + :ivar partner_namespaces: PartnerNamespacesOperations operations + :vartype partner_namespaces: azure.mgmt.eventgrid.aio.operations.PartnerNamespacesOperations + :ivar partner_registrations: PartnerRegistrationsOperations operations + :vartype partner_registrations: + azure.mgmt.eventgrid.aio.operations.PartnerRegistrationsOperations + :ivar partner_topics: PartnerTopicsOperations operations + :vartype partner_topics: azure.mgmt.eventgrid.aio.operations.PartnerTopicsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.eventgrid.aio.operations.PrivateEndpointConnectionsOperations @@ -45,10 +72,14 @@ class EventGridManagementClient: azure.mgmt.eventgrid.aio.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations :vartype system_topics: azure.mgmt.eventgrid.aio.operations.SystemTopicsOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.eventgrid.aio.operations.TopicsOperations :ivar extension_topics: ExtensionTopicsOperations operations :vartype extension_topics: azure.mgmt.eventgrid.aio.operations.ExtensionTopicsOperations :ivar topic_types: TopicTypesOperations operations :vartype topic_types: azure.mgmt.eventgrid.aio.operations.TopicTypesOperations + :ivar verified_partners: VerifiedPartnersOperations operations + :vartype verified_partners: azure.mgmt.eventgrid.aio.operations.VerifiedPartnersOperations :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 @@ -74,17 +105,29 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) 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_channels = EventChannelsOperations(self._client, self._config, self._serialize, self._deserialize) self.event_subscriptions = EventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_topic_event_subscriptions = DomainTopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.topic_event_subscriptions = TopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_event_subscriptions = DomainEventSubscriptionsOperations(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.partner_configurations = PartnerConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.partner_destinations = PartnerDestinationsOperations(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.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.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.topic_types = TopicTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.verified_partners = VerifiedPartnersOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py index c87a986b0809..258ebb7b5751 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py @@ -6,28 +6,52 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._channels_operations import ChannelsOperations from ._domains_operations import DomainsOperations from ._domain_topics_operations import DomainTopicsOperations +from ._event_channels_operations import EventChannelsOperations from ._event_subscriptions_operations import EventSubscriptionsOperations +from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations +from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations +from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations +from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations from ._operations import Operations -from ._topics_operations import TopicsOperations +from ._partner_configurations_operations import PartnerConfigurationsOperations +from ._partner_destinations_operations import PartnerDestinationsOperations +from ._partner_namespaces_operations import PartnerNamespacesOperations +from ._partner_registrations_operations import PartnerRegistrationsOperations +from ._partner_topics_operations import PartnerTopicsOperations from ._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 +from ._verified_partners_operations import VerifiedPartnersOperations __all__ = [ + 'ChannelsOperations', 'DomainsOperations', 'DomainTopicsOperations', + 'EventChannelsOperations', 'EventSubscriptionsOperations', + 'DomainTopicEventSubscriptionsOperations', + 'TopicEventSubscriptionsOperations', + 'DomainEventSubscriptionsOperations', 'SystemTopicEventSubscriptionsOperations', + 'PartnerTopicEventSubscriptionsOperations', 'Operations', - 'TopicsOperations', + 'PartnerConfigurationsOperations', + 'PartnerDestinationsOperations', + 'PartnerNamespacesOperations', + 'PartnerRegistrationsOperations', + 'PartnerTopicsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'SystemTopicsOperations', + 'TopicsOperations', 'ExtensionTopicsOperations', 'TopicTypesOperations', + 'VerifiedPartnersOperations', ] diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py new file mode 100644 index 000000000000..4f9fe2641563 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py @@ -0,0 +1,490 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._channels_operations import build_create_or_update_request, build_delete_request_initial, build_get_full_url_request, build_get_request, build_list_by_partner_namespace_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ChannelsOperations: + """ChannelsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> "_models.Channel": + """Get a channel. + + Get properties of a channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Channel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Channel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Channel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Channel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + channel_info: "_models.Channel", + **kwargs: Any + ) -> "_models.Channel": + """Create or update a channel. + + Synchronously creates or updates a new channel with the specified parameters. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :param channel_info: Channel information. + :type channel_info: ~azure.mgmt.eventgrid.models.Channel + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Channel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Channel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Channel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(channel_info, 'Channel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('Channel', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Channel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a channel. + + Delete an existing channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + channel_update_parameters: "_models.ChannelUpdateParameters", + **kwargs: Any + ) -> None: + """Update a Channel. + + Synchronously updates a channel with the specified parameters. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :param channel_update_parameters: Channel update information. + :type channel_update_parameters: ~azure.mgmt.eventgrid.models.ChannelUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(channel_update_parameters, 'ChannelUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + + if cls: + return cls(pipeline_response, None, {}) + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace + def list_by_partner_namespace( + self, + resource_group_name: str, + partner_namespace_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ChannelsListResult"]: + """List channels. + + List all the channels in a partner namespace. + + :param resource_group_name: The name of the resource group within the partners 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ChannelsListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.ChannelsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ChannelsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=self.list_by_partner_namespace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ChannelsListResult", 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_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels'} # type: ignore + + @distributed_trace_async + async def get_full_url( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of partner destination channel. + + Get the full endpoint URL of a partner destination channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the Channel. + :type channel_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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}/getFullUrl'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py new file mode 100644 index 000000000000..ed8a6f103c73 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py @@ -0,0 +1,660 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._domain_event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainEventSubscriptionsOperations: + """DomainEventSubscriptionsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a domain. + + Get properties of an event subscription 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 partner topic. + :type domain_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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Create or update an event subscription to a domain. + + Asynchronously creates a new event subscription or updates an existing event 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 topic. + :type domain_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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete an event subscription for a domain. + + Delete an existing event subscription 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 event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Update an event subscription for a domain. + + Update an existing event subscription for a 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 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async + async def get_full_url( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of an event subscription for domain. + + Get the full endpoint URL for an event subscription for 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 topic. + :type domain_name: 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventSubscriptionsListResult"]: + """List all event subscriptions for a specific domain. + + 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 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: 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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions'} # type: ignore + + @distributed_trace_async + async def get_delivery_attributes( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for domain. + + Get all delivery attributes for an event subscription for 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 topic. + :type domain_name: 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..3f1926b58e15 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py @@ -0,0 +1,694 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._domain_topic_event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DomainTopicEventSubscriptionsOperations: + """DomainTopicEventSubscriptionsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get a nested event subscription for domain topic. + + Get properties of a nested event subscription for 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 top level domain. + :type domain_name: str + :param topic_name: Name of the domain topic. + :type topic_name: 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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Create or update a nested event subscription to a domain topic. + + Asynchronously creates a new event subscription or updates an existing event 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 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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a nested event subscription for a domain topic. + + Delete a nested existing event subscription for 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 top level domain. + :type domain_name: str + :param topic_name: Name of the domain topic. + :type topic_name: str + :param event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Update a nested event subscription for a domain topic. + + Update an existing event subscription for 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 topic_name: Name of the topic. + :type topic_name: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async + async def get_full_url( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of a nested event subscription for domain topic. + + Get the full endpoint URL for a nested event subscription for 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 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventSubscriptionsListResult"]: + """List all nested 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 + :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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions'} # type: ignore + + @distributed_trace_async + async def get_delivery_attributes( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for domain topic. + + Get all delivery attributes for an event subscription for 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 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_channels_operations.py new file mode 100644 index 000000000000..4dc5bde66016 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_channels_operations.py @@ -0,0 +1,369 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._event_channels_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_by_partner_namespace_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventChannelsOperations: + """EventChannelsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> "_models.EventChannel": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventChannel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventChannel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventChannel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + event_channel_info: "_models.EventChannel", + **kwargs: Any + ) -> "_models.EventChannel": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventChannel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventChannel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_channel_info, 'EventChannel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventChannel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + @distributed_trace + def list_by_partner_namespace( + self, + resource_group_name: str, + partner_namespace_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EventChannelsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventChannelsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventChannelsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannelsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=self.list_by_partner_namespace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EventChannelsListResult", 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_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py index e1933fca74fa..ac7f57ec03fb 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py @@ -1270,9 +1270,9 @@ def list_by_resource( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.EventSubscriptionsListResult"]: - """List all event subscriptions for a specific topic. + """List all event subscriptions. - List all event subscriptions that have been created for a specific topic. + List all event subscriptions that have been created for a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py new file mode 100644 index 000000000000..00858751fbd5 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py @@ -0,0 +1,693 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_configurations_operations import build_authorize_partner_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_unauthorize_partner_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerConfigurationsOperations: + """PartnerConfigurationsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Get a partner configuration. + + Get properties of a partner configuration. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + partner_configuration_info: "_models.PartnerConfiguration", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_configuration_info, 'PartnerConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + partner_configuration_info: "_models.PartnerConfiguration", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerConfiguration"]: + """Create or update a partner configuration. + + Synchronously creates or updates a partner configuration 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_configuration_info: Partner configuration information. + :type partner_configuration_info: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerConfiguration or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + 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, + partner_configuration_info=partner_configuration_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerConfiguration', 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/partnerConfigurations/default'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a partner configuration. + + Delete existing partner configuration. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerConfigurations/default'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + partner_configuration_update_parameters: "_models.PartnerConfigurationUpdateParameters", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_configuration_update_parameters, 'PartnerConfigurationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + partner_configuration_update_parameters: "_models.PartnerConfigurationUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerConfiguration"]: + """Update a partner configuration. + + Synchronously updates a partner configuration 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_configuration_update_parameters: Partner configuration update information. + :type partner_configuration_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerConfigurationUpdateParameters + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerConfiguration or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + 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, + partner_configuration_update_parameters=partner_configuration_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerConfiguration', 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/partnerConfigurations/default'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerConfigurationsListResult"]: + """List partner configurations under a resource group. + + List all the partner configurations under a resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerConfigurationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerConfigurationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerConfigurationsListResult", 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerConfigurationsListResult"]: + """List partner configurations under an Azure subscription. + + List all the partner configurations 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 PartnerConfigurationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerConfigurationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerConfigurationsListResult", 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/partnerConfigurations'} # type: ignore + + @distributed_trace_async + async def authorize_partner( + self, + resource_group_name: str, + partner_info: "_models.Partner", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Authorize a partner. + + Authorize a single partner either by partner registration immutable Id or by partner name. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_info: The information of the partner to be authorized. + :type partner_info: ~azure.mgmt.eventgrid.models.Partner + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_info, 'Partner') + + request = build_authorize_partner_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.authorize_partner.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + authorize_partner.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/authorizePartner'} # type: ignore + + + @distributed_trace_async + async def unauthorize_partner( + self, + resource_group_name: str, + partner_info: "_models.Partner", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Unauthorize a partner. + + Unauthorize a single partner either by partner registration immutable Id or by partner name. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_info: The information of the partner to be unauthorized. + :type partner_info: ~azure.mgmt.eventgrid.models.Partner + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_info, 'Partner') + + request = build_unauthorize_partner_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.unauthorize_partner.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unauthorize_partner.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/unauthorizePartner'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py new file mode 100644 index 000000000000..fc4f26b9ed20 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py @@ -0,0 +1,555 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_destinations_operations import build_activate_request, build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerDestinationsOperations: + """PartnerDestinationsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> "_models.PartnerDestination": + """Get a partner destination. + + Get properties of a partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + partner_destination_name: str, + partner_destination: "_models.PartnerDestination", + **kwargs: Any + ) -> "_models.PartnerDestination": + """Create a partner destination. + + Asynchronously creates a new partner destination 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_destination_name: Name of the partner destination. + :type partner_destination_name: str + :param partner_destination: Partner destination create information. + :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_destination, 'PartnerDestination') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerDestination', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a partner destination. + + Delete existing partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_destination_name=partner_destination_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerDestinations/{partnerDestinationName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + partner_destination_name: str, + partner_destination_update_parameters: "_models.PartnerDestinationUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerDestination"]: + """Update a partner destination. + + Asynchronously updates a partner destination 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_destination_name: Name of the partner destination. + :type partner_destination_name: str + :param partner_destination_update_parameters: Partner destination update information. + :type partner_destination_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerDestination"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_destination_update_parameters, 'PartnerDestinationUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerDestinationsListResult"]: + """List partner destinations under an Azure subscription. + + List all the partner destinations 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 PartnerDestinationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerDestinationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestinationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerDestinationsListResult", 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/partnerDestinations'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerDestinationsListResult"]: + """List partner destinations under a resource group. + + List all the partner destinations 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 PartnerDestinationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerDestinationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestinationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerDestinationsListResult", 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/partnerDestinations'} # type: ignore + + @distributed_trace_async + async def activate( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> "_models.PartnerDestination": + """Activate a partner destination. + + Activate a newly created partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_activate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py new file mode 100644 index 000000000000..4642d841c764 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py @@ -0,0 +1,726 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_namespaces_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_shared_access_keys_request, build_regenerate_key_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerNamespacesOperations: + """PartnerNamespacesOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> "_models.PartnerNamespace": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_info: "_models.PartnerNamespace", + **kwargs: Any + ) -> "_models.PartnerNamespace": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_namespace_info, 'PartnerNamespace') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_info: "_models.PartnerNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerNamespace"]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + 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, + partner_namespace_name=partner_namespace_name, + partner_namespace_info=partner_namespace_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerNamespace', 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_namespace_name=partner_namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_update_parameters: "_models.PartnerNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_namespace_update_parameters, 'PartnerNamespaceUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_update_parameters: "_models.PartnerNamespaceUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerNamespace"]: + """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 partner_namespace_update_parameters: Partner namespace update information. + :type partner_namespace_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerNamespaceUpdateParameters + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + 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, + partner_namespace_name=partner_namespace_name, + partner_namespace_update_parameters=partner_namespace_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerNamespace', 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerNamespacesListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerNamespacesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerNamespacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerNamespacesListResult", 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/partnerNamespaces'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerNamespacesListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerNamespacesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerNamespacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerNamespacesListResult", 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/partnerNamespaces'} # type: ignore + + @distributed_trace_async + async def list_shared_access_keys( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> "_models.PartnerNamespaceSharedAccessKeys": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespaceSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespaceSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerNamespaceSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys'} # type: ignore + + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + partner_namespace_name: str, + regenerate_key_request: "_models.PartnerNamespaceRegenerateKeyRequest", + **kwargs: Any + ) -> "_models.PartnerNamespaceSharedAccessKeys": + """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 regenerate_key_request: Request body to regenerate key. + :type regenerate_key_request: ~azure.mgmt.eventgrid.models.PartnerNamespaceRegenerateKeyRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespaceSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespaceSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key_request, 'PartnerNamespaceRegenerateKeyRequest') + + request = build_regenerate_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerNamespaceSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py new file mode 100644 index 000000000000..6f94350453d2 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py @@ -0,0 +1,616 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_registrations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerRegistrationsOperations: + """PartnerRegistrationsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> "_models.PartnerRegistration": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerRegistration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_info: "_models.PartnerRegistration", + **kwargs: Any + ) -> "_models.PartnerRegistration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_registration_info, 'PartnerRegistration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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('PartnerRegistration', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_info: "_models.PartnerRegistration", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerRegistration"]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerRegistration or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + 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, + partner_registration_name=partner_registration_name, + partner_registration_info=partner_registration_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerRegistration', 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_registration_name=partner_registration_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_update_parameters: "_models.PartnerRegistrationUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerRegistration"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerRegistration"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_registration_update_parameters, 'PartnerRegistrationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_update_parameters: "_models.PartnerRegistrationUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.PartnerRegistration"]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 PartnerRegistration or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + 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, + partner_registration_name=partner_registration_name, + partner_registration_update_parameters=partner_registration_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerRegistration', 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerRegistrationsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerRegistrationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerRegistrationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistrationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerRegistrationsListResult", 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/partnerRegistrations'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerRegistrationsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerRegistrationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerRegistrationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistrationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerRegistrationsListResult", 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/partnerRegistrations'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..8975ab7bc108 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py @@ -0,0 +1,684 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_topic_event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_by_partner_topic_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerTopicEventSubscriptionsOperations: + """PartnerTopicEventSubscriptionsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a partner topic. + + Get properties of 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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete an event subscription of a partner topic. + + Delete an existing 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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Update event subscription of a partner topic. + + Update an existing 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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async + async def get_full_url( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """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 + :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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list_by_partner_topic( + self, + resource_group_name: str, + partner_topic_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EventSubscriptionsListResult"]: + """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 + :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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + filter=filter, + top=top, + template_url=self.list_by_partner_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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_partner_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions'} # type: ignore + + @distributed_trace_async + async def get_delivery_attributes( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription of a partner topic. + + Get all delivery attributes 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py new file mode 100644 index 000000000000..b232fd5f739d --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py @@ -0,0 +1,608 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._partner_topics_operations import build_activate_request, build_create_or_update_request, build_deactivate_request, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PartnerTopicsOperations: + """PartnerTopicsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + partner_topic_name: str, + partner_topic_info: "_models.PartnerTopic", + **kwargs: Any + ) -> "_models.PartnerTopic": + """Create a partner topic. + + Asynchronously creates a new 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 partner_topic_info: Partner Topic information. + :type partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_topic_info, 'PartnerTopic') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerTopic', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + partner_topic_name=partner_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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/partnerTopics/{partnerTopicName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + partner_topic_name: str, + partner_topic_update_parameters: "_models.PartnerTopicUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerTopic"]: + """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 partner_topic_update_parameters: PartnerTopic update information. + :type partner_topic_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerTopicUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerTopic"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_topic_update_parameters, 'PartnerTopicUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerTopicsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerTopicsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerTopicsListResult", 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/partnerTopics'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PartnerTopicsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerTopicsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PartnerTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerTopicsListResult", 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/partnerTopics'} # type: ignore + + @distributed_trace_async + async def activate( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_activate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate'} # type: ignore + + + @distributed_trace_async + async def deactivate( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_deactivate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.deactivate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate'} # 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 index 6e1e59d3f32c..91d6d414a58d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py @@ -52,22 +52,22 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum18"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Get a specific private endpoint connection. - Get a specific private endpoint connection under a topic or domain. + Get a specific private endpoint connection under a topic, domain, or partner namespace. :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.Enum18 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -115,7 +115,7 @@ async def get( async def _update_initial( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum19"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", @@ -169,7 +169,7 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum19"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", @@ -177,15 +177,15 @@ async def begin_update( ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Update a specific private endpoint connection. - Update a specific private endpoint connection under a topic or domain. + Update a specific private endpoint connection under a topic, domain or partner namespace. :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.Enum19 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -253,7 +253,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum20"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -293,22 +293,22 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum20"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a specific private endpoint connection. - Delete a specific private endpoint connection under a topic or domain. + Delete a specific private endpoint connection under a topic, domain, or partner namespace. :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.Enum20 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -367,7 +367,7 @@ def get_long_running_output(pipeline_response): def list_by_resource( self, resource_group_name: str, - parent_type: Union[str, "_models.Enum21"], + parent_type: Union[str, "_models.ParentType"], parent_name: str, filter: Optional[str] = None, top: Optional[int] = None, @@ -375,15 +375,15 @@ def list_by_resource( ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: """Lists all private endpoint connections under a resource. - Get all private endpoint connections under a topic or domain. + Get all private endpoint connections under a topic, domain, or partner namespace. :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.Enum21 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace 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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py index 42c3cc1daeb1..52d72f9e89b6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py @@ -61,11 +61,11 @@ async def get( :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\', + \'domains\', or \'partnerNamespaces\'. :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, domain + name, or partner namespace name). :type parent_name: str :param private_link_resource_name: The name of private link resource. :type private_link_resource_name: str @@ -119,17 +119,17 @@ def list_by_resource( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResourcesListResult"]: - """List private link resources under specific topic or domain. + """List private link resources under specific topic, domain, or partner namespace. - List all the private link resources under a topic or domain. + List all the private link resources under a topic, domain, or partner namespace. :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\', + \'domains\', or \'partnerNamespaces\'. :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, domain + name, or partner namespace 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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py index ab3c6afbc7d2..1d8f66a2c69f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py @@ -282,7 +282,7 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete an event subscription of a system topic. - Delete an event subscription of a system topic. + Delete an existing 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 @@ -399,7 +399,7 @@ async def begin_update( ) -> AsyncLROPoller["_models.EventSubscription"]: """Update event subscription of a system topic. - Update event subscription of a system topic. + Update an existing 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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..495c3bdaab07 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py @@ -0,0 +1,660 @@ +# 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 functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._topic_event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicEventSubscriptionsOperations: + """TopicEventSubscriptionsOperations 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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a topic. + + Get properties of an event subscription 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 partner topic. + :type 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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Create or update an event subscription to a topic. + + Asynchronously creates a new event subscription or updates an existing event 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 domain topic. + :type 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 + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete an event subscription for a topic. + + Delete an existing event subscription 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 event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.EventSubscription"]: + """Update an event subscription for a topic. + + Update an existing event subscription 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 domain. + :type topic_name: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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( + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async + async def get_full_url( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of an event subscription for topic. + + Get the full endpoint URL for an event subscription for 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 domain topic. + :type topic_name: 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> 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 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: 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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions'} # type: ignore + + @distributed_trace_async + async def get_delivery_attributes( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for topic. + + Get all delivery attributes for an event subscription for 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 domain topic. + :type topic_name: 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # 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 index ca99a5ead9f4..17c126789af7 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py @@ -663,8 +663,8 @@ async def _regenerate_key_initial( topic_name: str, regenerate_key_request: "_models.TopicRegenerateKeyRequest", **kwargs: Any - ) -> "_models.TopicSharedAccessKeys": - cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicSharedAccessKeys"] + ) -> Optional["_models.TopicSharedAccessKeys"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TopicSharedAccessKeys"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -688,11 +688,13 @@ async def _regenerate_key_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py new file mode 100644 index 000000000000..a6551c2065bd --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py @@ -0,0 +1,177 @@ +# 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 functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._verified_partners_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VerifiedPartnersOperations: + """VerifiedPartnersOperations 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 + + @distributed_trace_async + async def get( + self, + verified_partner_name: str, + **kwargs: Any + ) -> "_models.VerifiedPartner": + """Get a verified partner. + + Get properties of a verified partner. + + :param verified_partner_name: Name of the verified partner. + :type verified_partner_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VerifiedPartner, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerifiedPartner"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + verified_partner_name=verified_partner_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('VerifiedPartner', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName}'} # type: ignore + + + @distributed_trace + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VerifiedPartnersListResult"]: + """List all verified partners. + + Get a list of all verified partners. + + :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 VerifiedPartnersListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.VerifiedPartnersListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerifiedPartnersListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VerifiedPartnersListResult", 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.metadata = {'url': '/providers/Microsoft.EventGrid/verifiedPartners'} # 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 d0098742df38..c26fb5c688e0 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 @@ -6,185 +6,147 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AdvancedFilter - from ._models_py3 import AzureFunctionEventSubscriptionDestination - from ._models_py3 import BoolEqualsAdvancedFilter - from ._models_py3 import ConnectionState - from ._models_py3 import DeadLetterDestination - from ._models_py3 import DeadLetterWithResourceIdentity - from ._models_py3 import DeliveryAttributeListResult - from ._models_py3 import DeliveryAttributeMapping - from ._models_py3 import DeliveryWithResourceIdentity - from ._models_py3 import Domain - from ._models_py3 import DomainRegenerateKeyRequest - from ._models_py3 import DomainSharedAccessKeys - from ._models_py3 import DomainTopic - from ._models_py3 import DomainTopicsListResult - from ._models_py3 import DomainUpdateParameters - from ._models_py3 import DomainsListResult - from ._models_py3 import DynamicDeliveryAttributeMapping - from ._models_py3 import 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 EventTypesListResult - from ._models_py3 import ExtensionTopic - from ._models_py3 import HybridConnectionEventSubscriptionDestination - from ._models_py3 import IdentityInfo - from ._models_py3 import InboundIpRule - from ._models_py3 import InputSchemaMapping - from ._models_py3 import IsNotNullAdvancedFilter - from ._models_py3 import IsNullOrUndefinedAdvancedFilter - from ._models_py3 import JsonField - from ._models_py3 import JsonFieldWithDefault - from ._models_py3 import JsonInputSchemaMapping - from ._models_py3 import NumberGreaterThanAdvancedFilter - from ._models_py3 import NumberGreaterThanOrEqualsAdvancedFilter - from ._models_py3 import NumberInAdvancedFilter - from ._models_py3 import NumberInRangeAdvancedFilter - from ._models_py3 import NumberLessThanAdvancedFilter - from ._models_py3 import NumberLessThanOrEqualsAdvancedFilter - from ._models_py3 import NumberNotInAdvancedFilter - from ._models_py3 import NumberNotInRangeAdvancedFilter - from ._models_py3 import Operation - from ._models_py3 import OperationInfo - 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 RetryPolicy - from ._models_py3 import ServiceBusQueueEventSubscriptionDestination - from ._models_py3 import ServiceBusTopicEventSubscriptionDestination - from ._models_py3 import StaticDeliveryAttributeMapping - from ._models_py3 import StorageBlobDeadLetterDestination - from ._models_py3 import StorageQueueEventSubscriptionDestination - from ._models_py3 import StringBeginsWithAdvancedFilter - from ._models_py3 import StringContainsAdvancedFilter - from ._models_py3 import StringEndsWithAdvancedFilter - from ._models_py3 import StringInAdvancedFilter - from ._models_py3 import StringNotBeginsWithAdvancedFilter - from ._models_py3 import StringNotContainsAdvancedFilter - from ._models_py3 import StringNotEndsWithAdvancedFilter - from ._models_py3 import StringNotInAdvancedFilter - from ._models_py3 import SystemData - from ._models_py3 import SystemTopic - from ._models_py3 import SystemTopicUpdateParameters - from ._models_py3 import SystemTopicsListResult - from ._models_py3 import Topic - from ._models_py3 import TopicRegenerateKeyRequest - from ._models_py3 import TopicSharedAccessKeys - from ._models_py3 import 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 # 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 DeadLetterWithResourceIdentity # type: ignore - from ._models import DeliveryAttributeListResult # type: ignore - from ._models import DeliveryAttributeMapping # type: ignore - from ._models import DeliveryWithResourceIdentity # 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 DynamicDeliveryAttributeMapping # 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 EventSubscriptionIdentity # 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 ExtensionTopic # type: ignore - from ._models import HybridConnectionEventSubscriptionDestination # type: ignore - from ._models import IdentityInfo # type: ignore - from ._models import InboundIpRule # type: ignore - from ._models import InputSchemaMapping # type: ignore - from ._models import IsNotNullAdvancedFilter # type: ignore - from ._models import IsNullOrUndefinedAdvancedFilter # 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 NumberInRangeAdvancedFilter # type: ignore - from ._models import NumberLessThanAdvancedFilter # type: ignore - from ._models import NumberLessThanOrEqualsAdvancedFilter # type: ignore - from ._models import NumberNotInAdvancedFilter # type: ignore - from ._models import NumberNotInRangeAdvancedFilter # 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 StaticDeliveryAttributeMapping # 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 StringNotBeginsWithAdvancedFilter # type: ignore - from ._models import StringNotContainsAdvancedFilter # type: ignore - from ._models import StringNotEndsWithAdvancedFilter # type: ignore - from ._models import StringNotInAdvancedFilter # type: ignore - from ._models import SystemData # type: ignore - from ._models import SystemTopic # type: ignore - from ._models import SystemTopicUpdateParameters # type: ignore - from ._models import SystemTopicsListResult # 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 UserIdentityProperties # type: ignore - from ._models import WebHookEventSubscriptionDestination # type: ignore +from ._models_py3 import AdvancedFilter +from ._models_py3 import AzureADPartnerClientAuthentication +from ._models_py3 import AzureFunctionEventSubscriptionDestination +from ._models_py3 import BoolEqualsAdvancedFilter +from ._models_py3 import Channel +from ._models_py3 import ChannelUpdateParameters +from ._models_py3 import ChannelsListResult +from ._models_py3 import ConnectionState +from ._models_py3 import DeadLetterDestination +from ._models_py3 import DeadLetterWithResourceIdentity +from ._models_py3 import DeliveryAttributeListResult +from ._models_py3 import DeliveryAttributeMapping +from ._models_py3 import DeliveryWithResourceIdentity +from ._models_py3 import Domain +from ._models_py3 import DomainRegenerateKeyRequest +from ._models_py3 import DomainSharedAccessKeys +from ._models_py3 import DomainTopic +from ._models_py3 import DomainTopicsListResult +from ._models_py3 import DomainUpdateParameters +from ._models_py3 import DomainsListResult +from ._models_py3 import DynamicDeliveryAttributeMapping +from ._models_py3 import EventChannel +from ._models_py3 import EventChannelDestination +from ._models_py3 import EventChannelFilter +from ._models_py3 import EventChannelSource +from ._models_py3 import EventChannelsListResult +from ._models_py3 import EventHubEventSubscriptionDestination +from ._models_py3 import EventSubscription +from ._models_py3 import EventSubscriptionDestination +from ._models_py3 import EventSubscriptionFilter +from ._models_py3 import EventSubscriptionFullUrl +from ._models_py3 import EventSubscriptionIdentity +from ._models_py3 import EventSubscriptionUpdateParameters +from ._models_py3 import EventSubscriptionsListResult +from ._models_py3 import EventType +from ._models_py3 import EventTypeInfo +from ._models_py3 import EventTypesListResult +from ._models_py3 import ExtendedLocation +from ._models_py3 import ExtensionTopic +from ._models_py3 import HybridConnectionEventSubscriptionDestination +from ._models_py3 import IdentityInfo +from ._models_py3 import InboundIpRule +from ._models_py3 import InlineEventProperties +from ._models_py3 import InputSchemaMapping +from ._models_py3 import IsNotNullAdvancedFilter +from ._models_py3 import IsNullOrUndefinedAdvancedFilter +from ._models_py3 import JsonField +from ._models_py3 import JsonFieldWithDefault +from ._models_py3 import JsonInputSchemaMapping +from ._models_py3 import NumberGreaterThanAdvancedFilter +from ._models_py3 import NumberGreaterThanOrEqualsAdvancedFilter +from ._models_py3 import NumberInAdvancedFilter +from ._models_py3 import NumberInRangeAdvancedFilter +from ._models_py3 import NumberLessThanAdvancedFilter +from ._models_py3 import NumberLessThanOrEqualsAdvancedFilter +from ._models_py3 import NumberNotInAdvancedFilter +from ._models_py3 import NumberNotInRangeAdvancedFilter +from ._models_py3 import Operation +from ._models_py3 import OperationInfo +from ._models_py3 import OperationsListResult +from ._models_py3 import Partner +from ._models_py3 import PartnerAuthorization +from ._models_py3 import PartnerClientAuthentication +from ._models_py3 import PartnerConfiguration +from ._models_py3 import PartnerConfigurationUpdateParameters +from ._models_py3 import PartnerConfigurationsListResult +from ._models_py3 import PartnerDestination +from ._models_py3 import PartnerDestinationInfo +from ._models_py3 import PartnerDestinationUpdateParameters +from ._models_py3 import PartnerDestinationsListResult +from ._models_py3 import PartnerDetails +from ._models_py3 import PartnerEventSubscriptionDestination +from ._models_py3 import PartnerNamespace +from ._models_py3 import PartnerNamespaceRegenerateKeyRequest +from ._models_py3 import PartnerNamespaceSharedAccessKeys +from ._models_py3 import PartnerNamespaceUpdateParameters +from ._models_py3 import PartnerNamespacesListResult +from ._models_py3 import PartnerRegistration +from ._models_py3 import PartnerRegistrationUpdateParameters +from ._models_py3 import PartnerRegistrationsListResult +from ._models_py3 import PartnerTopic +from ._models_py3 import PartnerTopicInfo +from ._models_py3 import PartnerTopicUpdateParameters +from ._models_py3 import PartnerTopicsListResult +from ._models_py3 import PartnerUpdateDestinationInfo +from ._models_py3 import PartnerUpdateTopicInfo +from ._models_py3 import 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 ResourceMoveChangeHistory +from ._models_py3 import ResourceSku +from ._models_py3 import RetryPolicy +from ._models_py3 import ServiceBusQueueEventSubscriptionDestination +from ._models_py3 import ServiceBusTopicEventSubscriptionDestination +from ._models_py3 import StaticDeliveryAttributeMapping +from ._models_py3 import StorageBlobDeadLetterDestination +from ._models_py3 import StorageQueueEventSubscriptionDestination +from ._models_py3 import StringBeginsWithAdvancedFilter +from ._models_py3 import StringContainsAdvancedFilter +from ._models_py3 import StringEndsWithAdvancedFilter +from ._models_py3 import StringInAdvancedFilter +from ._models_py3 import StringNotBeginsWithAdvancedFilter +from ._models_py3 import StringNotContainsAdvancedFilter +from ._models_py3 import StringNotEndsWithAdvancedFilter +from ._models_py3 import StringNotInAdvancedFilter +from ._models_py3 import SystemData +from ._models_py3 import SystemTopic +from ._models_py3 import SystemTopicUpdateParameters +from ._models_py3 import SystemTopicsListResult +from ._models_py3 import Topic +from ._models_py3 import TopicRegenerateKeyRequest +from ._models_py3 import TopicSharedAccessKeys +from ._models_py3 import 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 VerifiedPartner +from ._models_py3 import VerifiedPartnersListResult +from ._models_py3 import WebHookEventSubscriptionDestination +from ._models_py3 import WebhookPartnerDestinationInfo +from ._models_py3 import WebhookUpdatePartnerDestinationInfo + from ._event_grid_management_client_enums import ( AdvancedFilterOperatorType, + ChannelProvisioningState, + ChannelType, CreatedByType, + DataResidencyBoundary, DeadLetterEndPointType, DeliveryAttributeMappingType, DomainProvisioningState, DomainTopicProvisioningState, EndpointType, - Enum18, - Enum19, - Enum20, - Enum21, + EventChannelProvisioningState, + EventDefinitionKind, EventDeliverySchema, EventSubscriptionIdentityType, EventSubscriptionProvisioningState, @@ -192,19 +154,40 @@ InputSchema, InputSchemaMappingType, IpActionType, + ParentType, + PartnerClientAuthenticationType, + PartnerConfigurationProvisioningState, + PartnerDestinationActivationState, + PartnerDestinationProvisioningState, + PartnerEndpointType, + PartnerNamespaceProvisioningState, + PartnerRegistrationProvisioningState, + PartnerRegistrationVisibilityState, + PartnerTopicActivationState, + PartnerTopicProvisioningState, + PartnerTopicReadinessState, + PartnerTopicRoutingMode, PersistedConnectionStatus, PublicNetworkAccess, + ReadinessState, + ResourceKind, ResourceProvisioningState, ResourceRegionType, + Sku, TopicProvisioningState, TopicTypePropertiesSupportedScopesForSourceItem, TopicTypeProvisioningState, + VerifiedPartnerProvisioningState, ) __all__ = [ 'AdvancedFilter', + 'AzureADPartnerClientAuthentication', 'AzureFunctionEventSubscriptionDestination', 'BoolEqualsAdvancedFilter', + 'Channel', + 'ChannelUpdateParameters', + 'ChannelsListResult', 'ConnectionState', 'DeadLetterDestination', 'DeadLetterWithResourceIdentity', @@ -219,6 +202,11 @@ 'DomainUpdateParameters', 'DomainsListResult', 'DynamicDeliveryAttributeMapping', + 'EventChannel', + 'EventChannelDestination', + 'EventChannelFilter', + 'EventChannelSource', + 'EventChannelsListResult', 'EventHubEventSubscriptionDestination', 'EventSubscription', 'EventSubscriptionDestination', @@ -228,11 +216,14 @@ 'EventSubscriptionUpdateParameters', 'EventSubscriptionsListResult', 'EventType', + 'EventTypeInfo', 'EventTypesListResult', + 'ExtendedLocation', 'ExtensionTopic', 'HybridConnectionEventSubscriptionDestination', 'IdentityInfo', 'InboundIpRule', + 'InlineEventProperties', 'InputSchemaMapping', 'IsNotNullAdvancedFilter', 'IsNullOrUndefinedAdvancedFilter', @@ -250,12 +241,40 @@ 'Operation', 'OperationInfo', 'OperationsListResult', + 'Partner', + 'PartnerAuthorization', + 'PartnerClientAuthentication', + 'PartnerConfiguration', + 'PartnerConfigurationUpdateParameters', + 'PartnerConfigurationsListResult', + 'PartnerDestination', + 'PartnerDestinationInfo', + 'PartnerDestinationUpdateParameters', + 'PartnerDestinationsListResult', + 'PartnerDetails', + 'PartnerEventSubscriptionDestination', + 'PartnerNamespace', + 'PartnerNamespaceRegenerateKeyRequest', + 'PartnerNamespaceSharedAccessKeys', + 'PartnerNamespaceUpdateParameters', + 'PartnerNamespacesListResult', + 'PartnerRegistration', + 'PartnerRegistrationUpdateParameters', + 'PartnerRegistrationsListResult', + 'PartnerTopic', + 'PartnerTopicInfo', + 'PartnerTopicUpdateParameters', + 'PartnerTopicsListResult', + 'PartnerUpdateDestinationInfo', + 'PartnerUpdateTopicInfo', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', 'PrivateLinkResource', 'PrivateLinkResourcesListResult', 'Resource', + 'ResourceMoveChangeHistory', + 'ResourceSku', 'RetryPolicy', 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopicEventSubscriptionDestination', @@ -283,18 +302,23 @@ 'TopicsListResult', 'TrackedResource', 'UserIdentityProperties', + 'VerifiedPartner', + 'VerifiedPartnersListResult', 'WebHookEventSubscriptionDestination', + 'WebhookPartnerDestinationInfo', + 'WebhookUpdatePartnerDestinationInfo', 'AdvancedFilterOperatorType', + 'ChannelProvisioningState', + 'ChannelType', 'CreatedByType', + 'DataResidencyBoundary', 'DeadLetterEndPointType', 'DeliveryAttributeMappingType', 'DomainProvisioningState', 'DomainTopicProvisioningState', 'EndpointType', - 'Enum18', - 'Enum19', - 'Enum20', - 'Enum21', + 'EventChannelProvisioningState', + 'EventDefinitionKind', 'EventDeliverySchema', 'EventSubscriptionIdentityType', 'EventSubscriptionProvisioningState', @@ -302,11 +326,28 @@ 'InputSchema', 'InputSchemaMappingType', 'IpActionType', + 'ParentType', + 'PartnerClientAuthenticationType', + 'PartnerConfigurationProvisioningState', + 'PartnerDestinationActivationState', + 'PartnerDestinationProvisioningState', + 'PartnerEndpointType', + 'PartnerNamespaceProvisioningState', + 'PartnerRegistrationProvisioningState', + 'PartnerRegistrationVisibilityState', + 'PartnerTopicActivationState', + 'PartnerTopicProvisioningState', + 'PartnerTopicReadinessState', + 'PartnerTopicRoutingMode', 'PersistedConnectionStatus', 'PublicNetworkAccess', + 'ReadinessState', + 'ResourceKind', 'ResourceProvisioningState', 'ResourceRegionType', + 'Sku', 'TopicProvisioningState', 'TopicTypePropertiesSupportedScopesForSourceItem', 'TopicTypeProvisioningState', + 'VerifiedPartnerProvisioningState', ] 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 465f1f4faa00..8c090c36f0f4 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 @@ -35,6 +35,24 @@ class AdvancedFilterOperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, En IS_NULL_OR_UNDEFINED = "IsNullOrUndefined" IS_NOT_NULL = "IsNotNull" +class ChannelProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the channel. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class ChannelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the event channel which represents the direction flow of events. + """ + + PARTNER_TOPIC = "PartnerTopic" + PARTNER_DESTINATION = "PartnerDestination" + class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -44,6 +62,13 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" +class DataResidencyBoundary(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Data Residency Boundary of the resource. + """ + + WITHIN_GEOPAIR = "WithinGeopair" + WITHIN_REGION = "WithinRegion" + class DeadLetterEndPointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the endpoint for the dead letter destination """ @@ -90,26 +115,24 @@ class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SERVICE_BUS_QUEUE = "ServiceBusQueue" SERVICE_BUS_TOPIC = "ServiceBusTopic" AZURE_FUNCTION = "AzureFunction" + PARTNER_DESTINATION = "PartnerDestination" -class Enum18(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - - TOPICS = "topics" - DOMAINS = "domains" - -class Enum19(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - - TOPICS = "topics" - DOMAINS = "domains" - -class Enum20(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EventChannelProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the event channel. + """ - TOPICS = "topics" - DOMAINS = "domains" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" -class Enum21(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EventDefinitionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The kind of event type used. + """ - TOPICS = "topics" - DOMAINS = "domains" + INLINE = "Inline" class EventDeliverySchema(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The event delivery schema for the event subscription. @@ -153,7 +176,7 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): 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 Domain Resource. """ EVENT_GRID_SCHEMA = "EventGridSchema" @@ -172,6 +195,121 @@ class IpActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" +class ParentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + TOPICS = "topics" + DOMAINS = "domains" + PARTNER_NAMESPACES = "partnerNamespaces" + +class PartnerClientAuthenticationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of client authentication + """ + + AZURE_AD = "AzureAD" + +class PartnerConfigurationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the partner configuration. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class PartnerDestinationActivationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Activation state of the partner destination. + """ + + NEVER_ACTIVATED = "NeverActivated" + ACTIVATED = "Activated" + +class PartnerDestinationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the partner destination. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class PartnerEndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the endpoint for the partner destination + """ + + WEB_HOOK = "WebHook" + +class PartnerNamespaceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the partner namespace. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class PartnerRegistrationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the partner registration. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class PartnerRegistrationVisibilityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Visibility state of the partner registration. + """ + + HIDDEN = "Hidden" + PUBLIC_PREVIEW = "PublicPreview" + GENERALLY_AVAILABLE = "GenerallyAvailable" + +class PartnerTopicActivationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Activation state of the partner topic. + """ + + NEVER_ACTIVATED = "NeverActivated" + ACTIVATED = "Activated" + DEACTIVATED = "Deactivated" + +class PartnerTopicProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the partner topic. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class PartnerTopicReadinessState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The readiness state of the corresponding partner topic. + """ + + NOT_ACTIVATED_BY_USER_YET = "NotActivatedByUserYet" + ACTIVATED_BY_USER = "ActivatedByUser" + DEACTIVATED_BY_USER = "DeactivatedByUser" + DELETED_BY_USER = "DeletedByUser" + +class PartnerTopicRoutingMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This determines if events published to this partner namespace should use the source attribute + in the event payload + or use the channel name in the header when matching to the partner topic. If none is specified, + source attribute routing will be used to match the partner topic. + """ + + SOURCE_EVENT_ATTRIBUTE = "SourceEventAttribute" + CHANNEL_NAME_HEADER = "ChannelNameHeader" + class PersistedConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the connection. """ @@ -191,6 +329,20 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" +class ReadinessState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The readiness state of the corresponding partner topic. + """ + + NEVER_ACTIVATED = "NeverActivated" + ACTIVATED = "Activated" + +class ResourceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Kind of the resource. + """ + + AZURE = "Azure" + AZURE_ARC = "AzureArc" + class ResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Private Endpoint Connection. """ @@ -209,6 +361,13 @@ class ResourceRegionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REGIONAL_RESOURCE = "RegionalResource" GLOBAL_RESOURCE = "GlobalResource" +class Sku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Sku name of the resource. The possible values are: Basic or Premium. + """ + + BASIC = "Basic" + PREMIUM = "Premium" + class TopicProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the topic. """ @@ -225,6 +384,7 @@ class TopicTypePropertiesSupportedScopesForSourceItem(with_metaclass(CaseInsensi RESOURCE = "Resource" RESOURCE_GROUP = "ResourceGroup" AZURE_SUBSCRIPTION = "AzureSubscription" + MANAGEMENT_GROUP = "ManagementGroup" class TopicTypeProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the topic type @@ -236,3 +396,14 @@ class TopicTypeProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, En SUCCEEDED = "Succeeded" CANCELED = "Canceled" FAILED = "Failed" + +class VerifiedPartnerProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the verified partner. + """ + + 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 deleted file mode 100644 index b354c6547278..000000000000 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py +++ /dev/null @@ -1,3884 +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 msrest.serialization - - -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: BoolEqualsAdvancedFilter, IsNotNullAdvancedFilter, IsNullOrUndefinedAdvancedFilter, NumberGreaterThanAdvancedFilter, NumberGreaterThanOrEqualsAdvancedFilter, NumberInAdvancedFilter, NumberInRangeAdvancedFilter, NumberLessThanAdvancedFilter, NumberLessThanOrEqualsAdvancedFilter, NumberNotInAdvancedFilter, NumberNotInRangeAdvancedFilter, StringBeginsWithAdvancedFilter, StringContainsAdvancedFilter, StringEndsWithAdvancedFilter, StringInAdvancedFilter, StringNotBeginsWithAdvancedFilter, StringNotContainsAdvancedFilter, StringNotEndsWithAdvancedFilter, StringNotInAdvancedFilter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - _subtype_map = { - 'operator_type': {'BoolEquals': 'BoolEqualsAdvancedFilter', 'IsNotNull': 'IsNotNullAdvancedFilter', 'IsNullOrUndefined': 'IsNullOrUndefinedAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberIn': 'NumberInAdvancedFilter', 'NumberInRange': 'NumberInRangeAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'NumberNotInRange': 'NumberNotInRangeAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotBeginsWith': 'StringNotBeginsWithAdvancedFilter', 'StringNotContains': 'StringNotContainsAdvancedFilter', 'StringNotEndsWith': 'StringNotEndsWithAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter'} - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - """ - super(AdvancedFilter, self).__init__(**kwargs) - self.operator_type = None # type: Optional[str] - self.key = kwargs.get('key', None) - - -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: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - } - - _subtype_map = { - 'endpoint_type': {'AzureFunction': 'AzureFunctionEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'WebHook': 'WebHookEventSubscriptionDestination'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(EventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = None # type: Optional[str] - - -class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the azure function destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource Id that represents the endpoint of the Azure Function - destination of an event subscription. - :vartype resource_id: str - :ivar max_events_per_batch: Maximum number of events per batch. - :vartype max_events_per_batch: int - :ivar preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :vartype preferred_batch_size_in_kilobytes: int - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'max_events_per_batch': {'key': 'properties.maxEventsPerBatch', 'type': 'int'}, - 'preferred_batch_size_in_kilobytes': {'key': 'properties.preferredBatchSizeInKilobytes', 'type': 'int'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource Id that represents the endpoint of the Azure Function - destination of an event subscription. - :paramtype resource_id: str - :keyword max_events_per_batch: Maximum number of events per batch. - :paramtype max_events_per_batch: int - :keyword preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :paramtype preferred_batch_size_in_kilobytes: int - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - 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', 1) - self.preferred_batch_size_in_kilobytes = kwargs.get('preferred_batch_size_in_kilobytes', 64) - self.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) - - -class BoolEqualsAdvancedFilter(AdvancedFilter): - """BoolEquals Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The boolean filter value. - :vartype value: bool - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The boolean filter value. - :paramtype value: bool - """ - super(BoolEqualsAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'BoolEquals' # type: str - self.value = kwargs.get('value', None) - - -class ConnectionState(msrest.serialization.Model): - """ConnectionState information. - - :ivar status: Status of the connection. Possible values include: "Pending", "Approved", - "Rejected", "Disconnected". - :vartype status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus - :ivar description: Description of the connection state. - :vartype description: str - :ivar actions_required: Actions required (if any). - :vartype actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: Status of the connection. Possible values include: "Pending", "Approved", - "Rejected", "Disconnected". - :paramtype status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus - :keyword description: Description of the connection state. - :paramtype description: str - :keyword actions_required: Actions required (if any). - :paramtype actions_required: str - """ - 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(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. - - All required parameters must be populated in order to send to Azure. - - :ivar endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant - filled by server. Possible values include: "StorageBlob". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - } - - _subtype_map = { - 'endpoint_type': {'StorageBlob': 'StorageBlobDeadLetterDestination'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeadLetterDestination, self).__init__(**kwargs) - self.endpoint_type = None # type: Optional[str] - - -class DeadLetterWithResourceIdentity(msrest.serialization.Model): - """Information about the deadletter destination with resource identity. - - :ivar identity: The identity to use when dead-lettering events. - :vartype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :ivar 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. - :vartype 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 - ): - """ - :keyword identity: The identity to use when dead-lettering events. - :paramtype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :keyword 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. - :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - """ - super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.dead_letter_destination = kwargs.get('dead_letter_destination', None) - - -class DeliveryAttributeListResult(msrest.serialization.Model): - """Result of the Get delivery attributes operation. - - :ivar value: A collection of DeliveryAttributeMapping. - :vartype value: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of DeliveryAttributeMapping. - :paramtype value: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - super(DeliveryAttributeListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DeliveryAttributeMapping(msrest.serialization.Model): - """Delivery attribute mapping details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DynamicDeliveryAttributeMapping, StaticDeliveryAttributeMapping. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Name of the delivery attribute or header. - :vartype name: str - :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. - Possible values include: "Static", "Dynamic". - :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Dynamic': 'DynamicDeliveryAttributeMapping', 'Static': 'StaticDeliveryAttributeMapping'} - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the delivery attribute or header. - :paramtype name: str - """ - super(DeliveryAttributeMapping, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None # type: Optional[str] - - -class DeliveryWithResourceIdentity(msrest.serialization.Model): - """Information about the delivery for an event subscription with resource identity. - - :ivar identity: The identity to use when delivering events. - :vartype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :ivar 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. - :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, - 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword identity: The identity to use when delivering events. - :paramtype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity - :keyword 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. - :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - """ - super(DeliveryWithResourceIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.destination = kwargs.get('destination', None) - - -class Resource(msrest.serialization.Model): - """Definition of a Resource. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """Definition of a Tracked Resource. - - 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 - :ivar location: Required. Location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': 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}'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword location: Required. Location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the resource. - :paramtype tags: dict[str, str] - """ - super(TrackedResource, self).__init__(**kwargs) - 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. - - 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 - :ivar location: Required. Location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the resource. - :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Domain resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :ivar identity: Identity information for the Event Grid Domain resource. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar private_endpoint_connections: List of private endpoint connections. - :vartype private_endpoint_connections: - list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar provisioning_state: Provisioning state of the Event Grid Domain Resource. 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 - :ivar 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". - :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :ivar input_schema_mapping: Information about the InputSchemaMapping which specified the info - about mapping event payload. - :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping - :ivar metric_resource_id: Metric resource id for the domain. - :vartype metric_resource_id: str - :ivar 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". - :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :ivar 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. - :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value - is false. When the property is set to true, only AAD token will be used to authenticate if user - is allowed to publish to the domain. - :vartype disable_local_auth: bool - :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, creation of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is null or set to true, Event Grid is responsible of automatically creating - the domain topic when the first event subscription is - created at the scope of the domain topic. If this property is set to false, then creating the - first event subscription will require creating a domain topic - by the user. The self-management mode can be used if the user wants full control of when the - domain topic is created, while auto-managed mode provides the - flexibility to perform less operations and manage fewer resources by the user. Also, note that - in auto-managed creation mode, user is allowed to create the - domain topic on demand if needed. - :vartype auto_create_topic_with_first_subscription: bool - :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, deletion of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is set to true, Event Grid is responsible of automatically deleting the - domain topic when the last event subscription at the scope - of the domain topic is deleted. If this property is set to false, then the user needs to - manually delete the domain topic when it is no longer needed - (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The - self-management mode can be used if the user wants full - control of when the domain topic needs to be deleted, while auto-managed mode provides the - flexibility to perform less operations and manage fewer - resources by the user. - :vartype auto_delete_topic_with_last_subscription: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'endpoint': {'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}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'input_schema': {'key': 'properties.inputSchema', 'type': 'str'}, - 'input_schema_mapping': {'key': 'properties.inputSchemaMapping', 'type': 'InputSchemaMapping'}, - 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'auto_create_topic_with_first_subscription': {'key': 'properties.autoCreateTopicWithFirstSubscription', 'type': 'bool'}, - 'auto_delete_topic_with_last_subscription': {'key': 'properties.autoDeleteTopicWithLastSubscription', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword location: Required. Location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the resource. - :paramtype tags: dict[str, str] - :keyword identity: Identity information for the Event Grid Domain resource. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword 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". - :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :keyword input_schema_mapping: Information about the InputSchemaMapping which specified the - info about mapping event payload. - :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping - :keyword 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". - :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :keyword 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. - :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default - value is false. When the property is set to true, only AAD token will be used to authenticate - if user is allowed to publish to the domain. - :paramtype disable_local_auth: bool - :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the - creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid - Domain resource. - In this context, creation of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is null or set to true, Event Grid is responsible of automatically creating - the domain topic when the first event subscription is - created at the scope of the domain topic. If this property is set to false, then creating the - first event subscription will require creating a domain topic - by the user. The self-management mode can be used if the user wants full control of when the - domain topic is created, while auto-managed mode provides the - flexibility to perform less operations and manage fewer resources by the user. Also, note that - in auto-managed creation mode, user is allowed to create the - domain topic on demand if needed. - :paramtype auto_create_topic_with_first_subscription: bool - :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, deletion of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is set to true, Event Grid is responsible of automatically deleting the - domain topic when the last event subscription at the scope - of the domain topic is deleted. If this property is set to false, then the user needs to - manually delete the domain topic when it is no longer needed - (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The - self-management mode can be used if the user wants full - control of when the domain topic needs to be deleted, while auto-managed mode provides the - flexibility to perform less operations and manage fewer - resources by the user. - :paramtype auto_delete_topic_with_last_subscription: bool - """ - super(Domain, self).__init__(**kwargs) - self.system_data = None - self.identity = kwargs.get('identity', None) - self.private_endpoint_connections = None - self.provisioning_state = None - self.endpoint = None - 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.disable_local_auth = kwargs.get('disable_local_auth', False) - self.auto_create_topic_with_first_subscription = kwargs.get('auto_create_topic_with_first_subscription', True) - self.auto_delete_topic_with_last_subscription = kwargs.get('auto_delete_topic_with_last_subscription', True) - - -class DomainRegenerateKeyRequest(msrest.serialization.Model): - """Domain regenerate share access key request. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. Key name to regenerate key1 or key2. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. Key name to regenerate key1 or key2. - :paramtype key_name: str - """ - super(DomainRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class DomainSharedAccessKeys(msrest.serialization.Model): - """Shared access keys of the Domain. - - :ivar key1: Shared access key1 for the domain. - :vartype key1: str - :ivar key2: Shared access key2 for the domain. - :vartype key2: str - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key1: Shared access key1 for the domain. - :paramtype key1: str - :keyword key2: Shared access key2 for the domain. - :paramtype key2: str - """ - super(DomainSharedAccessKeys, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) - - -class DomainsListResult(msrest.serialization.Model): - """Result of the List Domains operation. - - :ivar value: A collection of Domains. - :vartype value: list[~azure.mgmt.eventgrid.models.Domain] - :ivar next_link: A link for the next page of domains. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Domain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of Domains. - :paramtype value: list[~azure.mgmt.eventgrid.models.Domain] - :keyword next_link: A link for the next page of domains. - :paramtype next_link: str - """ - super(DomainsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', 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 - :ivar system_data: The system metadata relating to Domain Topic resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :ivar provisioning_state: Provisioning state of the domain topic. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainTopicProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DomainTopic, self).__init__(**kwargs) - self.system_data = None - self.provisioning_state = None - - -class DomainTopicsListResult(msrest.serialization.Model): - """Result of the List Domain Topics operation. - - :ivar value: A collection of Domain Topics. - :vartype value: list[~azure.mgmt.eventgrid.models.DomainTopic] - :ivar next_link: A link for the next page of domain topics. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DomainTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of Domain Topics. - :paramtype value: list[~azure.mgmt.eventgrid.models.DomainTopic] - :keyword next_link: A link for the next page of domain topics. - :paramtype next_link: str - """ - super(DomainTopicsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DomainUpdateParameters(msrest.serialization.Model): - """Properties of the Domain update. - - :ivar tags: A set of tags. Tags of the domains resource. - :vartype tags: dict[str, str] - :ivar identity: Identity information for the resource. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar 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". - :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :ivar 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. - :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value - is false. When the property is set to true, only AAD token will be used to authenticate if user - is allowed to publish to the domain. - :vartype disable_local_auth: bool - :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, creation of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is null or set to true, Event Grid is responsible of automatically creating - the domain topic when the first event subscription is - created at the scope of the domain topic. If this property is set to false, then creating the - first event subscription will require creating a domain topic - by the user. The self-management mode can be used if the user wants full control of when the - domain topic is created, while auto-managed mode provides the - flexibility to perform less operations and manage fewer resources by the user. Also, note that - in auto-managed creation mode, user is allowed to create the - domain topic on demand if needed. - :vartype auto_create_topic_with_first_subscription: bool - :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, deletion of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is set to true, Event Grid is responsible of automatically deleting the - domain topic when the last event subscription at the scope - of the domain topic is deleted. If this property is set to false, then the user needs to - manually delete the domain topic when it is no longer needed - (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The - self-management mode can be used if the user wants full - control of when the domain topic needs to be deleted, while auto-managed mode provides the - flexibility to perform less operations and manage fewer - resources by the user. - :vartype auto_delete_topic_with_last_subscription: bool - """ - - _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]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'auto_create_topic_with_first_subscription': {'key': 'properties.autoCreateTopicWithFirstSubscription', 'type': 'bool'}, - 'auto_delete_topic_with_last_subscription': {'key': 'properties.autoDeleteTopicWithLastSubscription', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Tags of the domains resource. - :paramtype tags: dict[str, str] - :keyword identity: Identity information for the resource. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword 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". - :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :keyword 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. - :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default - value is false. When the property is set to true, only AAD token will be used to authenticate - if user is allowed to publish to the domain. - :paramtype disable_local_auth: bool - :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the - creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid - Domain resource. - In this context, creation of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is null or set to true, Event Grid is responsible of automatically creating - the domain topic when the first event subscription is - created at the scope of the domain topic. If this property is set to false, then creating the - first event subscription will require creating a domain topic - by the user. The self-management mode can be used if the user wants full control of when the - domain topic is created, while auto-managed mode provides the - flexibility to perform less operations and manage fewer resources by the user. Also, note that - in auto-managed creation mode, user is allowed to create the - domain topic on demand if needed. - :paramtype auto_create_topic_with_first_subscription: bool - :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion - mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain - resource. - In this context, deletion of domain topic can be auto-managed (when true) or self-managed - (when false). The default value for this property is true. - When this property is set to true, Event Grid is responsible of automatically deleting the - domain topic when the last event subscription at the scope - of the domain topic is deleted. If this property is set to false, then the user needs to - manually delete the domain topic when it is no longer needed - (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The - self-management mode can be used if the user wants full - control of when the domain topic needs to be deleted, while auto-managed mode provides the - flexibility to perform less operations and manage fewer - resources by the user. - :paramtype auto_delete_topic_with_last_subscription: bool - """ - super(DomainUpdateParameters, 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.disable_local_auth = kwargs.get('disable_local_auth', None) - self.auto_create_topic_with_first_subscription = kwargs.get('auto_create_topic_with_first_subscription', None) - self.auto_delete_topic_with_last_subscription = kwargs.get('auto_delete_topic_with_last_subscription', None) - - -class DynamicDeliveryAttributeMapping(DeliveryAttributeMapping): - """Dynamic delivery attribute mapping details. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Name of the delivery attribute or header. - :vartype name: str - :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. - Possible values include: "Static", "Dynamic". - :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :ivar source_field: JSON path in the event which contains attribute value. - :vartype source_field: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'source_field': {'key': 'properties.sourceField', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the delivery attribute or header. - :paramtype name: str - :keyword source_field: JSON path in the event which contains attribute value. - :paramtype source_field: str - """ - super(DynamicDeliveryAttributeMapping, self).__init__(**kwargs) - self.type = 'Dynamic' # type: str - self.source_field = kwargs.get('source_field', None) - - -class EventHubEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the event hub destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource Id that represents the endpoint of an Event Hub - destination of an event subscription. - :vartype resource_id: str - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource Id that represents the endpoint of an Event Hub - destination of an event subscription. - :paramtype resource_id: str - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - super(EventHubEventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = 'EventHub' # type: str - self.resource_id = kwargs.get('resource_id', None) - self.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) - - -class EventSubscription(Resource): - """Event Subscription. - - 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 - :ivar system_data: The system metadata relating to Event Subscription resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :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". - :vartype provisioning_state: str or - ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState - :ivar destination: Information about the destination where events have to be delivered for the - event subscription. - :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :ivar 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. - :vartype delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity - :ivar filter: Information about the filter for the event subscription. - :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter - :ivar labels: List of user defined labels. - :vartype labels: list[str] - :ivar expiration_time_utc: Expiration time of the event subscription. - :vartype expiration_time_utc: ~datetime.datetime - :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible - values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :ivar retry_policy: The retry policy for events. This can be used to configure maximum number - of delivery attempts and time to live for events. - :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :ivar dead_letter_destination: The DeadLetter destination of the event subscription. - :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :ivar 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. - :vartype dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'topic': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - '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 - ): - """ - :keyword destination: Information about the destination where events have to be delivered for - the event subscription. - :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :keyword 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. - :paramtype delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity - :keyword filter: Information about the filter for the event subscription. - :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter - :keyword labels: List of user defined labels. - :paramtype labels: list[str] - :keyword expiration_time_utc: Expiration time of the event subscription. - :paramtype expiration_time_utc: ~datetime.datetime - :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible - values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :keyword retry_policy: The retry policy for events. This can be used to configure maximum - number of delivery attempts and time to live for events. - :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :keyword dead_letter_destination: The DeadLetter destination of the event subscription. - :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :keyword 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. - :paramtype dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity - """ - super(EventSubscription, self).__init__(**kwargs) - self.system_data = None - 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(msrest.serialization.Model): - """Filter for the Event Subscription. - - :ivar 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. - :vartype subject_begins_with: str - :ivar 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. - :vartype subject_ends_with: str - :ivar 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. - :vartype included_event_types: list[str] - :ivar is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith - properties of the filter - should be compared in a case sensitive manner. - :vartype is_subject_case_sensitive: bool - :ivar enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against an - array of values instead of expecting a singular value. - :vartype enable_advanced_filtering_on_arrays: bool - :ivar advanced_filters: An array of advanced filters that are used for filtering event - subscriptions. - :vartype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] - """ - - _attribute_map = { - 'subject_begins_with': {'key': 'subjectBeginsWith', 'type': 'str'}, - 'subject_ends_with': {'key': 'subjectEndsWith', 'type': 'str'}, - 'included_event_types': {'key': 'includedEventTypes', 'type': '[str]'}, - 'is_subject_case_sensitive': {'key': 'isSubjectCaseSensitive', 'type': 'bool'}, - 'enable_advanced_filtering_on_arrays': {'key': 'enableAdvancedFilteringOnArrays', 'type': 'bool'}, - 'advanced_filters': {'key': 'advancedFilters', 'type': '[AdvancedFilter]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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. - :paramtype subject_begins_with: str - :keyword 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. - :paramtype subject_ends_with: str - :keyword 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. - :paramtype included_event_types: list[str] - :keyword is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith - properties of the filter - should be compared in a case sensitive manner. - :paramtype is_subject_case_sensitive: bool - :keyword enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against - an array of values instead of expecting a singular value. - :paramtype enable_advanced_filtering_on_arrays: bool - :keyword advanced_filters: An array of advanced filters that are used for filtering event - subscriptions. - :paramtype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] - """ - 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) - self.included_event_types = kwargs.get('included_event_types', None) - self.is_subject_case_sensitive = kwargs.get('is_subject_case_sensitive', False) - self.enable_advanced_filtering_on_arrays = kwargs.get('enable_advanced_filtering_on_arrays', None) - self.advanced_filters = kwargs.get('advanced_filters', None) - - -class EventSubscriptionFullUrl(msrest.serialization.Model): - """Full endpoint url of an event subscription. - - :ivar endpoint_url: The URL that represents the endpoint of the destination of an event - subscription. - :vartype endpoint_url: str - """ - - _attribute_map = { - 'endpoint_url': {'key': 'endpointUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword endpoint_url: The URL that represents the endpoint of the destination of an event - subscription. - :paramtype endpoint_url: str - """ - super(EventSubscriptionFullUrl, self).__init__(**kwargs) - self.endpoint_url = kwargs.get('endpoint_url', None) - - -class EventSubscriptionIdentity(msrest.serialization.Model): - """The identity information with the event subscription. - - :ivar 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". - :vartype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType - :ivar user_assigned_identity: The user identity associated with the resource. - :vartype user_assigned_identity: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType - :keyword user_assigned_identity: The user identity associated with the resource. - :paramtype user_assigned_identity: str - """ - super(EventSubscriptionIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) - - -class EventSubscriptionsListResult(msrest.serialization.Model): - """Result of the List EventSubscriptions operation. - - :ivar value: A collection of EventSubscriptions. - :vartype value: list[~azure.mgmt.eventgrid.models.EventSubscription] - :ivar next_link: A link for the next page of event subscriptions. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EventSubscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of EventSubscriptions. - :paramtype value: list[~azure.mgmt.eventgrid.models.EventSubscription] - :keyword next_link: A link for the next page of event subscriptions. - :paramtype next_link: str - """ - super(EventSubscriptionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class EventSubscriptionUpdateParameters(msrest.serialization.Model): - """Properties of the Event Subscription update. - - :ivar destination: Information about the destination where events have to be delivered for the - event subscription. - :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :ivar 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. - :vartype delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity - :ivar filter: Information about the filter for the event subscription. - :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter - :ivar labels: List of user defined labels. - :vartype labels: list[str] - :ivar expiration_time_utc: Information about the expiration time for the event subscription. - :vartype expiration_time_utc: ~datetime.datetime - :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible - values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :ivar retry_policy: The retry policy for events. This can be used to configure maximum number - of delivery attempts and time to live for events. - :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :ivar dead_letter_destination: The DeadLetter destination of the event subscription. - :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :ivar 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. - :vartype dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity - """ - - _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 - ): - """ - :keyword destination: Information about the destination where events have to be delivered for - the event subscription. - :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :keyword 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. - :paramtype delivery_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity - :keyword filter: Information about the filter for the event subscription. - :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter - :keyword labels: List of user defined labels. - :paramtype labels: list[str] - :keyword expiration_time_utc: Information about the expiration time for the event subscription. - :paramtype expiration_time_utc: ~datetime.datetime - :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible - values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :keyword retry_policy: The retry policy for events. This can be used to configure maximum - number of delivery attempts and time to live for events. - :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :keyword dead_letter_destination: The DeadLetter destination of the event subscription. - :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :keyword 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. - :paramtype dead_letter_with_resource_identity: - ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity - """ - 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. - - :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 - :ivar display_name: Display name of the event type. - :vartype display_name: str - :ivar description: Description of the event type. - :vartype description: str - :ivar schema_url: Url of the schema for this event type. - :vartype schema_url: str - :ivar is_in_default_set: IsInDefaultSet flag of the event type. - :vartype is_in_default_set: bool - """ - - _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'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'schema_url': {'key': 'properties.schemaUrl', 'type': 'str'}, - 'is_in_default_set': {'key': 'properties.isInDefaultSet', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword display_name: Display name of the event type. - :paramtype display_name: str - :keyword description: Description of the event type. - :paramtype description: str - :keyword schema_url: Url of the schema for this event type. - :paramtype schema_url: str - :keyword is_in_default_set: IsInDefaultSet flag of the event type. - :paramtype is_in_default_set: bool - """ - super(EventType, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.schema_url = kwargs.get('schema_url', None) - self.is_in_default_set = kwargs.get('is_in_default_set', None) - - -class EventTypesListResult(msrest.serialization.Model): - """Result of the List Event Types operation. - - :ivar value: A collection of event types. - :vartype value: list[~azure.mgmt.eventgrid.models.EventType] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EventType]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of event types. - :paramtype value: list[~azure.mgmt.eventgrid.models.EventType] - """ - super(EventTypesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ExtensionTopic(Resource): - """Event grid Extension Topic. This is used for getting Event Grid related metrics for Azure resources. - - 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 - :ivar system_data: The system metadata relating to the Extension Topic resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :ivar description: Description of the extension topic. - :vartype description: str - :ivar system_topic: System topic resource id which is mapped to the source. - :vartype system_topic: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'system_topic': {'key': 'properties.systemTopic', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword description: Description of the extension topic. - :paramtype description: str - :keyword system_topic: System topic resource id which is mapped to the source. - :paramtype system_topic: str - """ - super(ExtensionTopic, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.system_topic = kwargs.get('system_topic', None) - - -class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the HybridConnection destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource ID of an hybrid connection that is the destination of an - event subscription. - :vartype resource_id: str - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource ID of an hybrid connection that is the destination of - an event subscription. - :paramtype resource_id: str - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - super(HybridConnectionEventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = 'HybridConnection' # type: str - self.resource_id = kwargs.get('resource_id', None) - self.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) - - -class IdentityInfo(msrest.serialization.Model): - """The identity information for the resource. - - :ivar 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". - :vartype type: str or ~azure.mgmt.eventgrid.models.IdentityType - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar 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. - :vartype 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 - ): - """ - :keyword 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". - :paramtype type: str or ~azure.mgmt.eventgrid.models.IdentityType - :keyword principal_id: The principal ID of resource identity. - :paramtype principal_id: str - :keyword tenant_id: The tenant ID of resource. - :paramtype tenant_id: str - :keyword 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. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.eventgrid.models.UserIdentityProperties] - """ - 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(msrest.serialization.Model): - """InboundIpRule. - - :ivar ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. - :vartype ip_mask: str - :ivar action: Action to perform based on the match or no match of the IpMask. Possible values - include: "Allow". - :vartype action: str or ~azure.mgmt.eventgrid.models.IpActionType - """ - - _attribute_map = { - 'ip_mask': {'key': 'ipMask', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. - :paramtype ip_mask: str - :keyword action: Action to perform based on the match or no match of the IpMask. Possible - values include: "Allow". - :paramtype action: str or ~azure.mgmt.eventgrid.models.IpActionType - """ - super(InboundIpRule, self).__init__(**kwargs) - self.ip_mask = kwargs.get('ip_mask', None) - self.action = kwargs.get('action', None) - - -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. - - All required parameters must be populated in order to send to Azure. - - :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType - """ - - _validation = { - 'input_schema_mapping_type': {'required': True}, - } - - _attribute_map = { - 'input_schema_mapping_type': {'key': 'inputSchemaMappingType', 'type': 'str'}, - } - - _subtype_map = { - 'input_schema_mapping_type': {'Json': 'JsonInputSchemaMapping'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(InputSchemaMapping, self).__init__(**kwargs) - self.input_schema_mapping_type = None # type: Optional[str] - - -class IsNotNullAdvancedFilter(AdvancedFilter): - """IsNotNull Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - """ - super(IsNotNullAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'IsNotNull' # type: str - - -class IsNullOrUndefinedAdvancedFilter(AdvancedFilter): - """IsNullOrUndefined Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - """ - super(IsNullOrUndefinedAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'IsNullOrUndefined' # type: str - - -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. - - :ivar source_field: Name of a field in the input event schema that's to be used as the source - of a mapping. - :vartype source_field: str - """ - - _attribute_map = { - 'source_field': {'key': 'sourceField', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword source_field: Name of a field in the input event schema that's to be used as the - source of a mapping. - :paramtype source_field: str - """ - super(JsonField, self).__init__(**kwargs) - self.source_field = kwargs.get('source_field', None) - - -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. - - :ivar source_field: Name of a field in the input event schema that's to be used as the source - of a mapping. - :vartype source_field: str - :ivar 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. - :vartype default_value: str - """ - - _attribute_map = { - 'source_field': {'key': 'sourceField', 'type': 'str'}, - 'default_value': {'key': 'defaultValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword source_field: Name of a field in the input event schema that's to be used as the - source of a mapping. - :paramtype source_field: str - :keyword 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. - :paramtype default_value: str - """ - 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. - - All required parameters must be populated in order to send to Azure. - - :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType - :ivar id: The mapping information for the Id property of the Event Grid Event. - :vartype id: ~azure.mgmt.eventgrid.models.JsonField - :ivar topic: The mapping information for the Topic property of the Event Grid Event. - :vartype topic: ~azure.mgmt.eventgrid.models.JsonField - :ivar event_time: The mapping information for the EventTime property of the Event Grid Event. - :vartype event_time: ~azure.mgmt.eventgrid.models.JsonField - :ivar event_type: The mapping information for the EventType property of the Event Grid Event. - :vartype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :ivar subject: The mapping information for the Subject property of the Event Grid Event. - :vartype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :ivar data_version: The mapping information for the DataVersion property of the Event Grid - Event. - :vartype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - """ - - _validation = { - 'input_schema_mapping_type': {'required': True}, - } - - _attribute_map = { - 'input_schema_mapping_type': {'key': 'inputSchemaMappingType', 'type': 'str'}, - 'id': {'key': 'properties.id', 'type': 'JsonField'}, - 'topic': {'key': 'properties.topic', 'type': 'JsonField'}, - 'event_time': {'key': 'properties.eventTime', 'type': 'JsonField'}, - 'event_type': {'key': 'properties.eventType', 'type': 'JsonFieldWithDefault'}, - 'subject': {'key': 'properties.subject', 'type': 'JsonFieldWithDefault'}, - 'data_version': {'key': 'properties.dataVersion', 'type': 'JsonFieldWithDefault'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The mapping information for the Id property of the Event Grid Event. - :paramtype id: ~azure.mgmt.eventgrid.models.JsonField - :keyword topic: The mapping information for the Topic property of the Event Grid Event. - :paramtype topic: ~azure.mgmt.eventgrid.models.JsonField - :keyword event_time: The mapping information for the EventTime property of the Event Grid - Event. - :paramtype event_time: ~azure.mgmt.eventgrid.models.JsonField - :keyword event_type: The mapping information for the EventType property of the Event Grid - Event. - :paramtype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :keyword subject: The mapping information for the Subject property of the Event Grid Event. - :paramtype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :keyword data_version: The mapping information for the DataVersion property of the Event Grid - Event. - :paramtype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - """ - 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) - - -class NumberGreaterThanAdvancedFilter(AdvancedFilter): - """NumberGreaterThan Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The filter value. - :paramtype value: float - """ - super(NumberGreaterThanAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberGreaterThan' # type: str - self.value = kwargs.get('value', None) - - -class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): - """NumberGreaterThanOrEquals Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The filter value. - :paramtype value: float - """ - super(NumberGreaterThanOrEqualsAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberGreaterThanOrEquals' # type: str - self.value = kwargs.get('value', None) - - -class NumberInAdvancedFilter(AdvancedFilter): - """NumberIn Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[float] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[float]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[float] - """ - super(NumberInAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberIn' # type: str - self.values = kwargs.get('values', None) - - -class NumberInRangeAdvancedFilter(AdvancedFilter): - """NumberInRange Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[list[float]] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[[float]]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[list[float]] - """ - super(NumberInRangeAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberInRange' # type: str - self.values = kwargs.get('values', None) - - -class NumberLessThanAdvancedFilter(AdvancedFilter): - """NumberLessThan Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The filter value. - :paramtype value: float - """ - super(NumberLessThanAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberLessThan' # type: str - self.value = kwargs.get('value', None) - - -class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): - """NumberLessThanOrEquals Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar value: The filter value. - :vartype value: float - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword value: The filter value. - :paramtype value: float - """ - super(NumberLessThanOrEqualsAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberLessThanOrEquals' # type: str - self.value = kwargs.get('value', None) - - -class NumberNotInAdvancedFilter(AdvancedFilter): - """NumberNotIn Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[float] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[float]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[float] - """ - super(NumberNotInAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberNotIn' # type: str - self.values = kwargs.get('values', None) - - -class NumberNotInRangeAdvancedFilter(AdvancedFilter): - """NumberNotInRange Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[list[float]] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[[float]]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[list[float]] - """ - super(NumberNotInRangeAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'NumberNotInRange' # type: str - self.values = kwargs.get('values', None) - - -class Operation(msrest.serialization.Model): - """Represents an operation returned by the GetOperations request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Display name of the operation. - :vartype display: ~azure.mgmt.eventgrid.models.OperationInfo - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationInfo'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.eventgrid.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: any - """ - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationInfo(msrest.serialization.Model): - """Information about an operation. - - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :vartype operation: str - :ivar description: Description of the operation. - :vartype description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword provider: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :paramtype operation: str - :keyword description: Description of the operation. - :paramtype description: str - """ - super(OperationInfo, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationsListResult(msrest.serialization.Model): - """Result of the List Operations operation. - - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.eventgrid.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of operations. - :paramtype value: list[~azure.mgmt.eventgrid.models.Operation] - """ - super(OperationsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """PrivateEndpoint information. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The ARM identifier for Private Endpoint. - :paramtype id: str - """ - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(Resource): - """PrivateEndpointConnection. - - 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 - :ivar private_endpoint: The Private Endpoint resource for this Connection. - :vartype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint - :ivar group_ids: GroupIds from the private link service resource. - :vartype group_ids: list[str] - :ivar private_link_service_connection_state: Details about the state of the connection. - :vartype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState - :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Possible - values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState - """ - - _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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword private_endpoint: The Private Endpoint resource for this Connection. - :paramtype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint - :keyword group_ids: GroupIds from the private link service resource. - :paramtype group_ids: list[str] - :keyword private_link_service_connection_state: Details about the state of the connection. - :paramtype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState - :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Possible - values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState - """ - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.group_ids = kwargs.get('group_ids', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """Result of the list of all private endpoint connections operation. - - :ivar value: A collection of private endpoint connection resources. - :vartype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :ivar next_link: A link for the next page of private endpoint connection resources. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of private endpoint connection resources. - :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :keyword next_link: A link for the next page of private endpoint connection resources. - :paramtype next_link: str - """ - 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. - - :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 - :ivar group_id: - :vartype group_id: str - :ivar display_name: - :vartype display_name: str - :ivar required_members: - :vartype required_members: list[str] - :ivar required_zone_names: - :vartype required_zone_names: list[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]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Fully qualified identifier of the resource. - :paramtype id: str - :keyword name: Name of the resource. - :paramtype name: str - :keyword type: Type of the resource. - :paramtype type: str - :keyword group_id: - :paramtype group_id: str - :keyword display_name: - :paramtype display_name: str - :keyword required_members: - :paramtype required_members: list[str] - :keyword required_zone_names: - :paramtype required_zone_names: list[str] - """ - 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) - - -class PrivateLinkResourcesListResult(msrest.serialization.Model): - """Result of the List private link resources operation. - - :ivar value: A collection of private link resources. - :vartype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] - :ivar next_link: A link for the next page of private link resources. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of private link resources. - :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] - :keyword next_link: A link for the next page of private link resources. - :paramtype next_link: str - """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RetryPolicy(msrest.serialization.Model): - """Information about the retry policy for an event subscription. - - :ivar max_delivery_attempts: Maximum number of delivery retry attempts for events. - :vartype max_delivery_attempts: int - :ivar event_time_to_live_in_minutes: Time To Live (in minutes) for events. - :vartype event_time_to_live_in_minutes: int - """ - - _attribute_map = { - 'max_delivery_attempts': {'key': 'maxDeliveryAttempts', 'type': 'int'}, - 'event_time_to_live_in_minutes': {'key': 'eventTimeToLiveInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword max_delivery_attempts: Maximum number of delivery retry attempts for events. - :paramtype max_delivery_attempts: int - :keyword event_time_to_live_in_minutes: Time To Live (in minutes) for events. - :paramtype event_time_to_live_in_minutes: int - """ - super(RetryPolicy, self).__init__(**kwargs) - self.max_delivery_attempts = kwargs.get('max_delivery_attempts', 30) - self.event_time_to_live_in_minutes = kwargs.get('event_time_to_live_in_minutes', 1440) - - -class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus - destination of an event subscription. - :vartype resource_id: str - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus - destination of an event subscription. - :paramtype resource_id: str - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = 'ServiceBusQueue' # type: str - self.resource_id = kwargs.get('resource_id', None) - self.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) - - -class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus topic destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic - destination of an event subscription. - :vartype resource_id: str - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus - Topic destination of an event subscription. - :paramtype resource_id: str - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) - self.endpoint_type = 'ServiceBusTopic' # type: str - self.resource_id = kwargs.get('resource_id', None) - self.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) - - -class StaticDeliveryAttributeMapping(DeliveryAttributeMapping): - """Static delivery attribute mapping details. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Name of the delivery attribute or header. - :vartype name: str - :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. - Possible values include: "Static", "Dynamic". - :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :ivar value: Value of the delivery attribute. - :vartype value: str - :ivar is_secret: Boolean flag to tell if the attribute contains sensitive information . - :vartype is_secret: bool - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'properties.value', 'type': 'str'}, - 'is_secret': {'key': 'properties.isSecret', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword name: Name of the delivery attribute or header. - :paramtype name: str - :keyword value: Value of the delivery attribute. - :paramtype value: str - :keyword is_secret: Boolean flag to tell if the attribute contains sensitive information . - :paramtype is_secret: bool - """ - super(StaticDeliveryAttributeMapping, self).__init__(**kwargs) - self.type = 'Static' # type: str - self.value = kwargs.get('value', None) - self.is_secret = kwargs.get('is_secret', False) - - -class StorageBlobDeadLetterDestination(DeadLetterDestination): - """Information about the storage blob based dead letter destination. - - All required parameters must be populated in order to send to Azure. - - :ivar endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant - filled by server. Possible values include: "StorageBlob". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType - :ivar resource_id: The Azure Resource ID of the storage account that is the destination of the - deadletter events. - :vartype resource_id: str - :ivar blob_container_name: The name of the Storage blob container that is the destination of - the deadletter events. - :vartype blob_container_name: str - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'blob_container_name': {'key': 'properties.blobContainerName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource ID of the storage account that is the destination of - the deadletter events. - :paramtype resource_id: str - :keyword blob_container_name: The name of the Storage blob container that is the destination of - the deadletter events. - :paramtype blob_container_name: str - """ - 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) - - -class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the storage queue destination for an event subscription. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar resource_id: The Azure Resource ID of the storage account that contains the queue that is - the destination of an event subscription. - :vartype resource_id: str - :ivar queue_name: The name of the Storage queue under a storage account that is the destination - of an event subscription. - :vartype queue_name: str - :ivar queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. - :vartype queue_message_time_to_live_in_seconds: long - """ - - _validation = { - 'endpoint_type': {'required': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'queue_name': {'key': 'properties.queueName', 'type': 'str'}, - 'queue_message_time_to_live_in_seconds': {'key': 'properties.queueMessageTimeToLiveInSeconds', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword resource_id: The Azure Resource ID of the storage account that contains the queue that - is the destination of an event subscription. - :paramtype resource_id: str - :keyword queue_name: The name of the Storage queue under a storage account that is the - destination of an event subscription. - :paramtype queue_name: str - :keyword queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. - :paramtype queue_message_time_to_live_in_seconds: long - """ - 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.queue_message_time_to_live_in_seconds = kwargs.get('queue_message_time_to_live_in_seconds', None) - - -class StringBeginsWithAdvancedFilter(AdvancedFilter): - """StringBeginsWith Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringBeginsWithAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringBeginsWith' # type: str - self.values = kwargs.get('values', None) - - -class StringContainsAdvancedFilter(AdvancedFilter): - """StringContains Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringContainsAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringContains' # type: str - self.values = kwargs.get('values', None) - - -class StringEndsWithAdvancedFilter(AdvancedFilter): - """StringEndsWith Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringEndsWithAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringEndsWith' # type: str - self.values = kwargs.get('values', None) - - -class StringInAdvancedFilter(AdvancedFilter): - """StringIn Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringInAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringIn' # type: str - self.values = kwargs.get('values', None) - - -class StringNotBeginsWithAdvancedFilter(AdvancedFilter): - """StringNotBeginsWith Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringNotBeginsWithAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringNotBeginsWith' # type: str - self.values = kwargs.get('values', None) - - -class StringNotContainsAdvancedFilter(AdvancedFilter): - """StringNotContains Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringNotContainsAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringNotContains' # type: str - self.values = kwargs.get('values', None) - - -class StringNotEndsWithAdvancedFilter(AdvancedFilter): - """StringNotEndsWith Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringNotEndsWithAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringNotEndsWith' # type: str - self.values = kwargs.get('values', None) - - -class StringNotInAdvancedFilter(AdvancedFilter): - """StringNotIn Advanced Filter. - - All required parameters must be populated in order to send to Azure. - - :ivar 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", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", - "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". - :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :ivar key: The field/property in the event based on which you want to filter. - :vartype key: str - :ivar values: The set of filter values. - :vartype values: list[str] - """ - - _validation = { - 'operator_type': {'required': True}, - } - - _attribute_map = { - 'operator_type': {'key': 'operatorType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key: The field/property in the event based on which you want to filter. - :paramtype key: str - :keyword values: The set of filter values. - :paramtype values: list[str] - """ - super(StringNotInAdvancedFilter, self).__init__(**kwargs) - self.operator_type = 'StringNotIn' # type: str - self.values = kwargs.get('values', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -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 - :ivar location: Required. Location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the resource. - :vartype tags: dict[str, str] - :ivar identity: Identity information for the resource. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar system_data: The system metadata relating to System Topic resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :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 - :ivar source: Source for the system topic. - :vartype source: str - :ivar topic_type: TopicType for the system topic. - :vartype 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}, - 'system_data': {'readonly': 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}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - '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 - ): - """ - :keyword location: Required. Location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the resource. - :paramtype tags: dict[str, str] - :keyword identity: Identity information for the resource. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword source: Source for the system topic. - :paramtype source: str - :keyword topic_type: TopicType for the system topic. - :paramtype topic_type: str - """ - super(SystemTopic, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.provisioning_state = None - self.source = kwargs.get('source', None) - self.topic_type = kwargs.get('topic_type', None) - self.metric_resource_id = None - - -class SystemTopicsListResult(msrest.serialization.Model): - """Result of the List System topics operation. - - :ivar value: A collection of system Topics. - :vartype value: list[~azure.mgmt.eventgrid.models.SystemTopic] - :ivar next_link: A link for the next page of topics. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SystemTopic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of system Topics. - :paramtype value: list[~azure.mgmt.eventgrid.models.SystemTopic] - :keyword next_link: A link for the next page of topics. - :paramtype next_link: str - """ - super(SystemTopicsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SystemTopicUpdateParameters(msrest.serialization.Model): - """Properties of the System Topic update. - - :ivar tags: A set of tags. Tags of the system topic. - :vartype tags: dict[str, str] - :ivar identity: Resource identity information. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Tags of the system topic. - :paramtype tags: dict[str, str] - :keyword identity: Resource identity information. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - """ - super(SystemTopicUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - - -class Topic(TrackedResource): - """EventGrid 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 - :ivar location: Required. Location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the resource. - :vartype tags: dict[str, str] - :ivar identity: Identity information for the resource. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar system_data: The system metadata relating to Topic resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :ivar private_endpoint_connections: - :vartype 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 endpoint: Endpoint for the topic. - :vartype endpoint: str - :ivar 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". - :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :ivar 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. - :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping - :ivar metric_resource_id: Metric resource id for the topic. - :vartype metric_resource_id: str - :ivar 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". - :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :ivar 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. - :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value - is false. When the property is set to true, only AAD token will be used to authenticate if user - is allowed to publish to the topic. - :vartype disable_local_auth: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'endpoint': {'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}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'input_schema': {'key': 'properties.inputSchema', 'type': 'str'}, - 'input_schema_mapping': {'key': 'properties.inputSchemaMapping', 'type': 'InputSchemaMapping'}, - 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword location: Required. Location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the resource. - :paramtype tags: dict[str, str] - :keyword identity: Identity information for the resource. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword 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". - :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :keyword 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. - :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping - :keyword 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". - :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :keyword 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. - :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default - value is false. When the property is set to true, only AAD token will be used to authenticate - if user is allowed to publish to the topic. - :paramtype disable_local_auth: bool - """ - super(Topic, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.private_endpoint_connections = None - self.provisioning_state = None - self.endpoint = None - 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.disable_local_auth = kwargs.get('disable_local_auth', False) - - -class TopicRegenerateKeyRequest(msrest.serialization.Model): - """Topic regenerate share access key request. - - All required parameters must be populated in order to send to Azure. - - :ivar key_name: Required. Key name to regenerate key1 or key2. - :vartype key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_name: Required. Key name to regenerate key1 or key2. - :paramtype key_name: str - """ - super(TopicRegenerateKeyRequest, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class TopicSharedAccessKeys(msrest.serialization.Model): - """Shared access keys of the Topic. - - :ivar key1: Shared access key1 for the topic. - :vartype key1: str - :ivar key2: Shared access key2 for the topic. - :vartype key2: str - """ - - _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key1: Shared access key1 for the topic. - :paramtype key1: str - :keyword key2: Shared access key2 for the topic. - :paramtype key2: str - """ - 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. - - :ivar value: A collection of Topics. - :vartype value: list[~azure.mgmt.eventgrid.models.Topic] - :ivar next_link: A link for the next page of topics. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Topic]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of Topics. - :paramtype value: list[~azure.mgmt.eventgrid.models.Topic] - :keyword next_link: A link for the next page of topics. - :paramtype next_link: str - """ - 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. - - :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 - :ivar provider: Namespace of the provider of the topic type. - :vartype provider: str - :ivar display_name: Display Name for the topic type. - :vartype display_name: str - :ivar description: Description of the topic type. - :vartype description: str - :ivar resource_region_type: Region type of the resource. Possible values include: - "RegionalResource", "GlobalResource". - :vartype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType - :ivar provisioning_state: Provisioning state of the topic type. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :ivar supported_locations: List of locations supported by this topic type. - :vartype supported_locations: list[str] - :ivar source_resource_format: Source resource format. - :vartype source_resource_format: str - :ivar supported_scopes_for_source: Supported source scopes. - :vartype supported_scopes_for_source: list[str or - ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] - """ - - _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'}, - 'provider': {'key': 'properties.provider', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'resource_region_type': {'key': 'properties.resourceRegionType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'supported_locations': {'key': 'properties.supportedLocations', 'type': '[str]'}, - 'source_resource_format': {'key': 'properties.sourceResourceFormat', 'type': 'str'}, - 'supported_scopes_for_source': {'key': 'properties.supportedScopesForSource', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword provider: Namespace of the provider of the topic type. - :paramtype provider: str - :keyword display_name: Display Name for the topic type. - :paramtype display_name: str - :keyword description: Description of the topic type. - :paramtype description: str - :keyword resource_region_type: Region type of the resource. Possible values include: - "RegionalResource", "GlobalResource". - :paramtype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType - :keyword provisioning_state: Provisioning state of the topic type. Possible values include: - "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :keyword supported_locations: List of locations supported by this topic type. - :paramtype supported_locations: list[str] - :keyword source_resource_format: Source resource format. - :paramtype source_resource_format: str - :keyword supported_scopes_for_source: Supported source scopes. - :paramtype supported_scopes_for_source: list[str or - ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] - """ - super(TopicTypeInfo, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.resource_region_type = kwargs.get('resource_region_type', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.supported_locations = kwargs.get('supported_locations', None) - self.source_resource_format = kwargs.get('source_resource_format', None) - self.supported_scopes_for_source = kwargs.get('supported_scopes_for_source', None) - - -class TopicTypesListResult(msrest.serialization.Model): - """Result of the List Topic Types operation. - - :ivar value: A collection of topic types. - :vartype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TopicTypeInfo]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: A collection of topic types. - :paramtype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] - """ - super(TopicTypesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class TopicUpdateParameters(msrest.serialization.Model): - """Properties of the Topic update. - - :ivar tags: A set of tags. Tags of the resource. - :vartype tags: dict[str, str] - :ivar identity: Topic resource identity information. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :ivar 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". - :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :ivar 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. - :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value - is false. When the property is set to true, only AAD token will be used to authenticate if user - is allowed to publish to the topic. - :vartype disable_local_auth: bool - """ - - _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]'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword tags: A set of tags. Tags of the resource. - :paramtype tags: dict[str, str] - :keyword identity: Topic resource identity information. - :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :keyword 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". - :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess - :keyword 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. - :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default - value is false. When the property is set to true, only AAD token will be used to authenticate - if user is allowed to publish to the topic. - :paramtype disable_local_auth: bool - """ - 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.disable_local_auth = kwargs.get('disable_local_auth', None) - - -class UserIdentityProperties(msrest.serialization.Model): - """The information about the user identity. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword principal_id: The principal id of user assigned identity. - :paramtype principal_id: str - :keyword client_id: The client id of user assigned identity. - :paramtype client_id: str - """ - 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. - - All required parameters must be populated in order to send to Azure. - - :ivar 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". - :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :ivar endpoint_url: The URL that represents the endpoint of the destination of an event - subscription. - :vartype endpoint_url: str - :ivar endpoint_base_url: The base URL that represents the endpoint of the destination of an - event subscription. - :vartype endpoint_base_url: str - :ivar max_events_per_batch: Maximum number of events per batch. - :vartype max_events_per_batch: int - :ivar preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :vartype preferred_batch_size_in_kilobytes: int - :ivar 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. - :vartype azure_active_directory_tenant_id: str - :ivar 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. - :vartype azure_active_directory_application_id_or_uri: str - :ivar delivery_attribute_mappings: Delivery attribute details. - :vartype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - - _validation = { - 'endpoint_type': {'required': True}, - 'endpoint_base_url': {'readonly': True}, - } - - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'endpoint_url': {'key': 'properties.endpointUrl', 'type': 'str'}, - 'endpoint_base_url': {'key': 'properties.endpointBaseUrl', 'type': 'str'}, - 'max_events_per_batch': {'key': 'properties.maxEventsPerBatch', 'type': 'int'}, - 'preferred_batch_size_in_kilobytes': {'key': 'properties.preferredBatchSizeInKilobytes', 'type': 'int'}, - 'azure_active_directory_tenant_id': {'key': 'properties.azureActiveDirectoryTenantId', 'type': 'str'}, - 'azure_active_directory_application_id_or_uri': {'key': 'properties.azureActiveDirectoryApplicationIdOrUri', 'type': 'str'}, - 'delivery_attribute_mappings': {'key': 'properties.deliveryAttributeMappings', 'type': '[DeliveryAttributeMapping]'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword endpoint_url: The URL that represents the endpoint of the destination of an event - subscription. - :paramtype endpoint_url: str - :keyword max_events_per_batch: Maximum number of events per batch. - :paramtype max_events_per_batch: int - :keyword preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :paramtype preferred_batch_size_in_kilobytes: int - :keyword 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. - :paramtype azure_active_directory_tenant_id: str - :keyword 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. - :paramtype azure_active_directory_application_id_or_uri: str - :keyword delivery_attribute_mappings: Delivery attribute details. - :paramtype delivery_attribute_mappings: - list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] - """ - 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', 1) - self.preferred_batch_size_in_kilobytes = kwargs.get('preferred_batch_size_in_kilobytes', 64) - 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.delivery_attribute_mappings = kwargs.get('delivery_attribute_mappings', None) 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 263fa736ff2b..89d0d7a601ab 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 @@ -61,17 +61,103 @@ def __init__( self.key = key +class PartnerClientAuthentication(msrest.serialization.Model): + """Partner client authentication. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureADPartnerClientAuthentication. + + All required parameters must be populated in order to send to Azure. + + :ivar client_authentication_type: Required. Type of client authentication.Constant filled by + server. Possible values include: "AzureAD". Default value: "AzureAD". + :vartype client_authentication_type: str or + ~azure.mgmt.eventgrid.models.PartnerClientAuthenticationType + """ + + _validation = { + 'client_authentication_type': {'required': True}, + } + + _attribute_map = { + 'client_authentication_type': {'key': 'clientAuthenticationType', 'type': 'str'}, + } + + _subtype_map = { + 'client_authentication_type': {'AzureAD': 'AzureADPartnerClientAuthentication'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PartnerClientAuthentication, self).__init__(**kwargs) + self.client_authentication_type = None # type: Optional[str] + + +class AzureADPartnerClientAuthentication(PartnerClientAuthentication): + """Azure Active Directory Partner Client Authentication. + + All required parameters must be populated in order to send to Azure. + + :ivar client_authentication_type: Required. Type of client authentication.Constant filled by + server. Possible values include: "AzureAD". Default value: "AzureAD". + :vartype client_authentication_type: str or + ~azure.mgmt.eventgrid.models.PartnerClientAuthenticationType + :ivar 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. + :vartype azure_active_directory_tenant_id: str + :ivar 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. + :vartype azure_active_directory_application_id_or_uri: str + """ + + _validation = { + 'client_authentication_type': {'required': True}, + } + + _attribute_map = { + 'client_authentication_type': {'key': 'clientAuthenticationType', 'type': 'str'}, + 'azure_active_directory_tenant_id': {'key': 'properties.azureActiveDirectoryTenantId', 'type': 'str'}, + 'azure_active_directory_application_id_or_uri': {'key': 'properties.azureActiveDirectoryApplicationIdOrUri', 'type': 'str'}, + } + + def __init__( + self, + *, + azure_active_directory_tenant_id: Optional[str] = None, + azure_active_directory_application_id_or_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword 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. + :paramtype azure_active_directory_tenant_id: str + :keyword 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. + :paramtype azure_active_directory_application_id_or_uri: str + """ + super(AzureADPartnerClientAuthentication, self).__init__(**kwargs) + self.client_authentication_type = 'AzureAD' # type: str + 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 + + 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: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination. + sub-classes are: AzureFunctionEventSubscriptionDestination, EventHubEventSubscriptionDestination, HybridConnectionEventSubscriptionDestination, PartnerEventSubscriptionDestination, ServiceBusQueueEventSubscriptionDestination, ServiceBusTopicEventSubscriptionDestination, StorageQueueEventSubscriptionDestination, WebHookEventSubscriptionDestination. All required parameters must be populated in order to send to Azure. :ivar 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". + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction", + "PartnerDestination". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType """ @@ -84,7 +170,7 @@ class EventSubscriptionDestination(msrest.serialization.Model): } _subtype_map = { - 'endpoint_type': {'AzureFunction': 'AzureFunctionEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'WebHook': 'WebHookEventSubscriptionDestination'} + 'endpoint_type': {'AzureFunction': 'AzureFunctionEventSubscriptionDestination', 'EventHub': 'EventHubEventSubscriptionDestination', 'HybridConnection': 'HybridConnectionEventSubscriptionDestination', 'PartnerDestination': 'PartnerEventSubscriptionDestination', 'ServiceBusQueue': 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopic': 'ServiceBusTopicEventSubscriptionDestination', 'StorageQueue': 'StorageQueueEventSubscriptionDestination', 'WebHook': 'WebHookEventSubscriptionDestination'} } def __init__( @@ -104,7 +190,8 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): :ivar 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". + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction", + "PartnerDestination". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. @@ -205,6 +292,229 @@ def __init__( self.value = value +class Resource(msrest.serialization.Model): + """Definition of a Resource. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Channel(Resource): + """Channel info. + + 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 + :ivar system_data: The system metadata relating to Channel resource. + :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData + :ivar channel_type: The type of the event channel which represents the direction flow of + events. Possible values include: "PartnerTopic", "PartnerDestination". + :vartype channel_type: str or ~azure.mgmt.eventgrid.models.ChannelType + :ivar partner_topic_info: This property should be populated when channelType is PartnerTopic + and represents information about the partner topic resource corresponding to the channel. + :vartype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopicInfo + :ivar partner_destination_info: This property should be populated when channelType is + PartnerDestination and represents information about the partner destination resource + corresponding to the channel. + :vartype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerDestinationInfo + :ivar message_for_activation: Context or helpful message that can be used during the approval + process by the subscriber. + :vartype message_for_activation: str + :ivar provisioning_state: Provisioning state of the channel. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ChannelProvisioningState + :ivar readiness_state: The readiness state of the corresponding partner topic. Possible values + include: "NeverActivated", "Activated". + :vartype readiness_state: str or ~azure.mgmt.eventgrid.models.ReadinessState + :ivar expiration_time_if_not_activated_utc: Expiration time of the channel. If this timer + expires while the corresponding partner topic is never activated, + the channel and corresponding partner topic are deleted. + :vartype expiration_time_if_not_activated_utc: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'channel_type': {'key': 'properties.channelType', 'type': 'str'}, + 'partner_topic_info': {'key': 'properties.partnerTopicInfo', 'type': 'PartnerTopicInfo'}, + 'partner_destination_info': {'key': 'properties.partnerDestinationInfo', 'type': 'PartnerDestinationInfo'}, + 'message_for_activation': {'key': 'properties.messageForActivation', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'readiness_state': {'key': 'properties.readinessState', 'type': 'str'}, + 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + channel_type: Optional[Union[str, "ChannelType"]] = None, + partner_topic_info: Optional["PartnerTopicInfo"] = None, + partner_destination_info: Optional["PartnerDestinationInfo"] = None, + message_for_activation: Optional[str] = None, + provisioning_state: Optional[Union[str, "ChannelProvisioningState"]] = None, + readiness_state: Optional[Union[str, "ReadinessState"]] = None, + expiration_time_if_not_activated_utc: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword channel_type: The type of the event channel which represents the direction flow of + events. Possible values include: "PartnerTopic", "PartnerDestination". + :paramtype channel_type: str or ~azure.mgmt.eventgrid.models.ChannelType + :keyword partner_topic_info: This property should be populated when channelType is PartnerTopic + and represents information about the partner topic resource corresponding to the channel. + :paramtype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopicInfo + :keyword partner_destination_info: This property should be populated when channelType is + PartnerDestination and represents information about the partner destination resource + corresponding to the channel. + :paramtype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerDestinationInfo + :keyword message_for_activation: Context or helpful message that can be used during the + approval process by the subscriber. + :paramtype message_for_activation: str + :keyword provisioning_state: Provisioning state of the channel. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.ChannelProvisioningState + :keyword readiness_state: The readiness state of the corresponding partner topic. Possible + values include: "NeverActivated", "Activated". + :paramtype readiness_state: str or ~azure.mgmt.eventgrid.models.ReadinessState + :keyword expiration_time_if_not_activated_utc: Expiration time of the channel. If this timer + expires while the corresponding partner topic is never activated, + the channel and corresponding partner topic are deleted. + :paramtype expiration_time_if_not_activated_utc: ~datetime.datetime + """ + super(Channel, self).__init__(**kwargs) + self.system_data = None + self.channel_type = channel_type + self.partner_topic_info = partner_topic_info + self.partner_destination_info = partner_destination_info + self.message_for_activation = message_for_activation + self.provisioning_state = provisioning_state + self.readiness_state = readiness_state + self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc + + +class ChannelsListResult(msrest.serialization.Model): + """Result of the List Channels operation. + + :ivar value: A collection of Channels. + :vartype value: list[~azure.mgmt.eventgrid.models.Channel] + :ivar next_link: A link for the next page of channels. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Channel]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Channel"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: A collection of Channels. + :paramtype value: list[~azure.mgmt.eventgrid.models.Channel] + :keyword next_link: A link for the next page of channels. + :paramtype next_link: str + """ + super(ChannelsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ChannelUpdateParameters(msrest.serialization.Model): + """Properties of the Channel update. + + :ivar expiration_time_if_not_activated_utc: Expiration time of the event channel. If this timer + expires while the corresponding partner topic or partner destination is never activated, + the channel and corresponding partner topic or partner destination are deleted. + :vartype expiration_time_if_not_activated_utc: ~datetime.datetime + :ivar partner_destination_info: Partner destination properties which can be updated if the + channel is of type PartnerDestination. + :vartype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerUpdateDestinationInfo + :ivar partner_topic_info: Partner topic properties which can be updated if the channel is of + type PartnerTopic. + :vartype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerUpdateTopicInfo + """ + + _attribute_map = { + 'expiration_time_if_not_activated_utc': {'key': 'properties.expirationTimeIfNotActivatedUtc', 'type': 'iso-8601'}, + 'partner_destination_info': {'key': 'properties.partnerDestinationInfo', 'type': 'PartnerUpdateDestinationInfo'}, + 'partner_topic_info': {'key': 'properties.partnerTopicInfo', 'type': 'PartnerUpdateTopicInfo'}, + } + + def __init__( + self, + *, + expiration_time_if_not_activated_utc: Optional[datetime.datetime] = None, + partner_destination_info: Optional["PartnerUpdateDestinationInfo"] = None, + partner_topic_info: Optional["PartnerUpdateTopicInfo"] = None, + **kwargs + ): + """ + :keyword expiration_time_if_not_activated_utc: Expiration time of the event channel. If this + timer expires while the corresponding partner topic or partner destination is never activated, + the channel and corresponding partner topic or partner destination are deleted. + :paramtype expiration_time_if_not_activated_utc: ~datetime.datetime + :keyword partner_destination_info: Partner destination properties which can be updated if the + channel is of type PartnerDestination. + :paramtype partner_destination_info: ~azure.mgmt.eventgrid.models.PartnerUpdateDestinationInfo + :keyword partner_topic_info: Partner topic properties which can be updated if the channel is of + type PartnerTopic. + :paramtype partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerUpdateTopicInfo + """ + super(ChannelUpdateParameters, self).__init__(**kwargs) + self.expiration_time_if_not_activated_utc = expiration_time_if_not_activated_utc + self.partner_destination_info = partner_destination_info + self.partner_topic_info = partner_topic_info + + class ConnectionState(msrest.serialization.Model): """ConnectionState information. @@ -425,43 +735,6 @@ def __init__( self.destination = destination -class Resource(msrest.serialization.Model): - """Definition of a Resource. - - 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - class TrackedResource(Resource): """Definition of a Tracked Resource. @@ -531,26 +804,29 @@ class Domain(TrackedResource): :vartype location: str :ivar tags: A set of tags. Tags of the resource. :vartype tags: dict[str, str] - :ivar system_data: The system metadata relating to Domain resource. - :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData + :ivar sku: The Sku pricing tier for the Event Grid Domain resource. + :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar identity: Identity information for the Event Grid Domain resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar system_data: The system metadata relating to the Event Grid Domain resource. + :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] :ivar provisioning_state: Provisioning state of the Event Grid Domain Resource. 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. + :ivar endpoint: Endpoint for the Event Grid Domain Resource which is used for publishing the + events. :vartype endpoint: str :ivar input_schema: This determines the format that Event Grid should expect for incoming - events published to the domain. Possible values include: "EventGridSchema", + events published to the Event Grid Domain Resource. Possible values include: "EventGridSchema", "CustomEventSchema", "CloudEventSchemaV1_0". :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema :ivar input_schema_mapping: Information about the InputSchemaMapping which specified the info about mapping event payload. :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping - :ivar metric_resource_id: Metric resource id for the domain. + :ivar metric_resource_id: Metric resource id for the Event Grid Domain Resource. :vartype metric_resource_id: str :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. @@ -595,6 +871,9 @@ class Domain(TrackedResource): flexibility to perform less operations and manage fewer resources by the user. :vartype auto_delete_topic_with_last_subscription: bool + :ivar data_residency_boundary: Data Residency Boundary of the resource. Possible values + include: "WithinGeopair", "WithinRegion". + :vartype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ _validation = { @@ -615,8 +894,9 @@ class Domain(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, @@ -628,6 +908,7 @@ class Domain(TrackedResource): 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, 'auto_create_topic_with_first_subscription': {'key': 'properties.autoCreateTopicWithFirstSubscription', 'type': 'bool'}, 'auto_delete_topic_with_last_subscription': {'key': 'properties.autoDeleteTopicWithLastSubscription', 'type': 'bool'}, + 'data_residency_boundary': {'key': 'properties.dataResidencyBoundary', 'type': 'str'}, } def __init__( @@ -635,6 +916,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + sku: Optional["ResourceSku"] = None, identity: Optional["IdentityInfo"] = None, input_schema: Optional[Union[str, "InputSchema"]] = None, input_schema_mapping: Optional["InputSchemaMapping"] = None, @@ -643,6 +925,7 @@ def __init__( disable_local_auth: Optional[bool] = False, auto_create_topic_with_first_subscription: Optional[bool] = True, auto_delete_topic_with_last_subscription: Optional[bool] = True, + data_residency_boundary: Optional[Union[str, "DataResidencyBoundary"]] = None, **kwargs ): """ @@ -650,10 +933,12 @@ def __init__( :paramtype location: str :keyword tags: A set of tags. Tags of the resource. :paramtype tags: dict[str, str] + :keyword sku: The Sku pricing tier for the Event Grid Domain resource. + :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword identity: Identity information for the Event Grid Domain resource. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :keyword input_schema: This determines the format that Event Grid should expect for incoming - events published to the domain. Possible values include: "EventGridSchema", + events published to the Event Grid Domain Resource. Possible values include: "EventGridSchema", "CustomEventSchema", "CloudEventSchemaV1_0". :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema :keyword input_schema_mapping: Information about the InputSchemaMapping which specified the @@ -702,10 +987,14 @@ def __init__( flexibility to perform less operations and manage fewer resources by the user. :paramtype auto_delete_topic_with_last_subscription: bool + :keyword data_residency_boundary: Data Residency Boundary of the resource. Possible values + include: "WithinGeopair", "WithinRegion". + :paramtype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ super(Domain, self).__init__(location=location, tags=tags, **kwargs) - self.system_data = None + self.sku = sku self.identity = identity + self.system_data = None self.private_endpoint_connections = None self.provisioning_state = None self.endpoint = None @@ -717,6 +1006,7 @@ def __init__( self.disable_local_auth = disable_local_auth self.auto_create_topic_with_first_subscription = auto_create_topic_with_first_subscription self.auto_delete_topic_with_last_subscription = auto_delete_topic_with_last_subscription + self.data_residency_boundary = data_residency_boundary class DomainRegenerateKeyRequest(msrest.serialization.Model): @@ -898,6 +1188,8 @@ class DomainUpdateParameters(msrest.serialization.Model): :vartype tags: dict[str, str] :ivar identity: Identity information for the resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar sku: The Sku pricing tier for the domain. + :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar 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". + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar 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. + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value + is false. When the property is set to true, only AAD token will be used to authenticate if user + is allowed to publish to the partner namespace. + :vartype disable_local_auth: bool + :ivar partner_topic_routing_mode: This determines if events published to this partner namespace + should use the source attribute in the event payload + or use the channel name in the header when matching to the partner topic. If none is + specified, source attribute routing will be used to match the partner topic. Possible values + include: "SourceEventAttribute", "ChannelNameHeader". Default value: "SourceEventAttribute". + :vartype partner_topic_routing_mode: str or + ~azure.mgmt.eventgrid.models.PartnerTopicRoutingMode + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'private_endpoint_connections': {'readonly': 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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_registration_fully_qualified_id': {'key': 'properties.partnerRegistrationFullyQualifiedId', 'type': 'str'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'partner_topic_routing_mode': {'key': 'properties.partnerTopicRoutingMode', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + partner_registration_fully_qualified_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + disable_local_auth: Optional[bool] = False, + partner_topic_routing_mode: Optional[Union[str, "PartnerTopicRoutingMode"]] = "SourceEventAttribute", + **kwargs + ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword 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}. + :paramtype partner_registration_fully_qualified_id: str + :keyword 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". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword 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. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the partner namespace. + :paramtype disable_local_auth: bool + :keyword partner_topic_routing_mode: This determines if events published to this partner + namespace should use the source attribute in the event payload + or use the channel name in the header when matching to the partner topic. If none is + specified, source attribute routing will be used to match the partner topic. Possible values + include: "SourceEventAttribute", "ChannelNameHeader". Default value: "SourceEventAttribute". + :paramtype partner_topic_routing_mode: str or + ~azure.mgmt.eventgrid.models.PartnerTopicRoutingMode + """ + super(PartnerNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.system_data = None + self.private_endpoint_connections = None + self.provisioning_state = None + self.partner_registration_fully_qualified_id = partner_registration_fully_qualified_id + self.endpoint = None + self.public_network_access = public_network_access + self.inbound_ip_rules = inbound_ip_rules + self.disable_local_auth = disable_local_auth + self.partner_topic_routing_mode = partner_topic_routing_mode + + +class PartnerNamespaceRegenerateKeyRequest(msrest.serialization.Model): + """PartnerNamespace regenerate shared access key request. + + All required parameters must be populated in order to send to Azure. + + :ivar key_name: Required. Key name to regenerate (key1 or key2). + :vartype key_name: str + """ + + _validation = { + 'key_name': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + **kwargs + ): + """ + :keyword key_name: Required. Key name to regenerate (key1 or key2). + :paramtype key_name: str + """ + super(PartnerNamespaceRegenerateKeyRequest, self).__init__(**kwargs) + self.key_name = key_name + + +class PartnerNamespaceSharedAccessKeys(msrest.serialization.Model): + """Shared access keys of the partner namespace. + + :ivar key1: Shared access key1 for the partner namespace. + :vartype key1: str + :ivar key2: Shared access key2 for the partner namespace. + :vartype key2: str + """ + + _attribute_map = { + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, + } + + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): + """ + :keyword key1: Shared access key1 for the partner namespace. + :paramtype key1: str + :keyword key2: Shared access key2 for the partner namespace. + :paramtype key2: str + """ + super(PartnerNamespaceSharedAccessKeys, self).__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 + + +class PartnerNamespacesListResult(msrest.serialization.Model): + """Result of the List Partner Namespaces operation. + + :ivar value: A collection of partner namespaces. + :vartype value: list[~azure.mgmt.eventgrid.models.PartnerNamespace] + :ivar next_link: A link for the next page of partner namespaces. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PartnerNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PartnerNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: A collection of partner namespaces. + :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerNamespace] + :keyword next_link: A link for the next page of partner namespaces. + :paramtype next_link: str + """ + super(PartnerNamespacesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartnerNamespaceUpdateParameters(msrest.serialization.Model): + """Properties of the Partner Namespace update. + + :ivar tags: A set of tags. Tags of the Partner Namespace. + :vartype tags: dict[str, str] + :ivar 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". + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar 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. + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value + is false. When the property is set to true, only AAD token will be used to authenticate if user + is allowed to publish to the partner namespace. + :vartype disable_local_auth: bool + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + inbound_ip_rules: Optional[List["InboundIpRule"]] = None, + disable_local_auth: Optional[bool] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Tags of the Partner Namespace. + :paramtype tags: dict[str, str] + :keyword 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". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword 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. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the partner namespace. + :paramtype disable_local_auth: bool + """ + super(PartnerNamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.public_network_access = public_network_access + self.inbound_ip_rules = inbound_ip_rules + self.disable_local_auth = disable_local_auth + + +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 + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: The system metadata relating to Partner Registration resource. + :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData + :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 + :ivar partner_registration_immutable_id: The immutableId of the corresponding partner + registration. + :vartype partner_registration_immutable_id: str + :ivar partner_name: Official name of the partner name. For example: "Contoso". + :vartype partner_name: str + :ivar partner_resource_type_name: Name of the partner resource type. + :vartype partner_resource_type_name: str + :ivar partner_resource_type_display_name: Display name of the partner resource type. + :vartype partner_resource_type_display_name: str + :ivar partner_resource_type_description: Short description of the partner resource type. The + length of this description should not exceed 256 characters. + :vartype partner_resource_type_description: str + :ivar 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. + :vartype long_description: str + :ivar 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. + :vartype partner_customer_service_number: str + :ivar 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. + :vartype partner_customer_service_extension: str + :ivar customer_service_uri: The extension of the customer service URI of the publisher. + :vartype customer_service_uri: str + :ivar setup_uri: URI of the partner website that can be used by Azure customers to setup Event + Grid + integration on an event source. + :vartype setup_uri: str + :ivar logo_uri: URI of the logo. + :vartype logo_uri: str + :ivar visibility_state: Visibility state of the partner registration. Possible values include: + "Hidden", "PublicPreview", "GenerallyAvailable". + :vartype visibility_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState + :ivar 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. + :vartype authorized_azure_subscription_ids: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': 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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_registration_immutable_id': {'key': 'properties.partnerRegistrationImmutableId', '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: Optional[Dict[str, str]] = None, + partner_registration_immutable_id: Optional[str] = None, + partner_name: Optional[str] = None, + partner_resource_type_name: Optional[str] = None, + partner_resource_type_display_name: Optional[str] = None, + partner_resource_type_description: Optional[str] = None, + long_description: Optional[str] = None, + partner_customer_service_number: Optional[str] = None, + partner_customer_service_extension: Optional[str] = None, + customer_service_uri: Optional[str] = None, + setup_uri: Optional[str] = None, + logo_uri: Optional[str] = None, + visibility_state: Optional[Union[str, "PartnerRegistrationVisibilityState"]] = None, + authorized_azure_subscription_ids: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword partner_registration_immutable_id: The immutableId of the corresponding partner + registration. + :paramtype partner_registration_immutable_id: str + :keyword partner_name: Official name of the partner name. For example: "Contoso". + :paramtype partner_name: str + :keyword partner_resource_type_name: Name of the partner resource type. + :paramtype partner_resource_type_name: str + :keyword partner_resource_type_display_name: Display name of the partner resource type. + :paramtype partner_resource_type_display_name: str + :keyword partner_resource_type_description: Short description of the partner resource type. The + length of this description should not exceed 256 characters. + :paramtype partner_resource_type_description: str + :keyword 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. + :paramtype long_description: str + :keyword 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. + :paramtype partner_customer_service_number: str + :keyword 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. + :paramtype partner_customer_service_extension: str + :keyword customer_service_uri: The extension of the customer service URI of the publisher. + :paramtype customer_service_uri: str + :keyword setup_uri: URI of the partner website that can be used by Azure customers to setup + Event Grid + integration on an event source. + :paramtype setup_uri: str + :keyword logo_uri: URI of the logo. + :paramtype logo_uri: str + :keyword visibility_state: Visibility state of the partner registration. Possible values + include: "Hidden", "PublicPreview", "GenerallyAvailable". + :paramtype visibility_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState + :keyword 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. + :paramtype authorized_azure_subscription_ids: list[str] + """ + super(PartnerRegistration, self).__init__(location=location, tags=tags, **kwargs) + self.system_data = None + self.provisioning_state = None + self.partner_registration_immutable_id = partner_registration_immutable_id + 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 PartnerRegistrationsListResult(msrest.serialization.Model): + """Result of the List Partner Registrations operation. + + :ivar value: A collection of partner registrations. + :vartype value: list[~azure.mgmt.eventgrid.models.PartnerRegistration] + :ivar next_link: A link for the next page of partner registrations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PartnerRegistration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PartnerRegistration"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: A collection of partner registrations. + :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerRegistration] + :keyword next_link: A link for the next page of partner registrations. + :paramtype next_link: str + """ + super(PartnerRegistrationsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartnerRegistrationUpdateParameters(msrest.serialization.Model): + """Properties of the Partner Registration update. + + :ivar tags: A set of tags. Tags of the partner registration resource. + :vartype tags: dict[str, str] + :ivar partner_topic_type_name: Name of the partner topic type. + :vartype partner_topic_type_name: str + :ivar partner_topic_type_display_name: Display name of the partner topic type. + :vartype partner_topic_type_display_name: str + :ivar partner_topic_type_description: Description of the partner topic type. + :vartype partner_topic_type_description: str + :ivar setup_uri: URI of the partner website that can be used by Azure customers to setup Event + Grid + integration on an event source. + :vartype setup_uri: str + :ivar logo_uri: URI of the partner logo. + :vartype logo_uri: str + :ivar 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. + :vartype 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: Optional[Dict[str, str]] = None, + partner_topic_type_name: Optional[str] = None, + partner_topic_type_display_name: Optional[str] = None, + partner_topic_type_description: Optional[str] = None, + setup_uri: Optional[str] = None, + logo_uri: Optional[str] = None, + authorized_azure_subscription_ids: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Tags of the partner registration resource. + :paramtype tags: dict[str, str] + :keyword partner_topic_type_name: Name of the partner topic type. + :paramtype partner_topic_type_name: str + :keyword partner_topic_type_display_name: Display name of the partner topic type. + :paramtype partner_topic_type_display_name: str + :keyword partner_topic_type_description: Description of the partner topic type. + :paramtype partner_topic_type_description: str + :keyword setup_uri: URI of the partner website that can be used by Azure customers to setup + Event Grid + integration on an event source. + :paramtype setup_uri: str + :keyword logo_uri: URI of the partner logo. + :paramtype logo_uri: str + :keyword 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. + :paramtype authorized_azure_subscription_ids: list[str] + """ + 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): + """Event Grid 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 + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar system_data: The system metadata relating to Partner Topic resource. + :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData + :ivar identity: Identity information for the Partner Topic resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar partner_registration_immutable_id: The immutableId of the corresponding partner + registration. + :vartype partner_registration_immutable_id: str + :ivar source: Source associated with this partner topic. This represents a unique partner + resource. + :vartype source: str + :ivar event_type_info: Event Type information from the corresponding event channel. + :vartype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo + :ivar 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. + :vartype expiration_time_if_not_activated_utc: ~datetime.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 + :ivar activation_state: Activation state of the partner topic. Possible values include: + "NeverActivated", "Activated", "Deactivated". + :vartype activation_state: str or ~azure.mgmt.eventgrid.models.PartnerTopicActivationState + :ivar 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. + :vartype partner_topic_friendly_description: str + :ivar message_for_activation: Context or helpful message that can be used during the approval + process by the subscriber. + :vartype message_for_activation: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': 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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'partner_registration_immutable_id': {'key': 'properties.partnerRegistrationImmutableId', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'event_type_info': {'key': 'properties.eventTypeInfo', 'type': 'EventTypeInfo'}, + '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'}, + 'message_for_activation': {'key': 'properties.messageForActivation', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["IdentityInfo"] = None, + partner_registration_immutable_id: Optional[str] = None, + source: Optional[str] = None, + event_type_info: Optional["EventTypeInfo"] = None, + expiration_time_if_not_activated_utc: Optional[datetime.datetime] = None, + activation_state: Optional[Union[str, "PartnerTopicActivationState"]] = None, + partner_topic_friendly_description: Optional[str] = None, + message_for_activation: Optional[str] = None, + **kwargs + ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the Partner Topic resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword partner_registration_immutable_id: The immutableId of the corresponding partner + registration. + :paramtype partner_registration_immutable_id: str + :keyword source: Source associated with this partner topic. This represents a unique partner + resource. + :paramtype source: str + :keyword event_type_info: Event Type information from the corresponding event channel. + :paramtype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo + :keyword 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. + :paramtype expiration_time_if_not_activated_utc: ~datetime.datetime + :keyword activation_state: Activation state of the partner topic. Possible values include: + "NeverActivated", "Activated", "Deactivated". + :paramtype activation_state: str or ~azure.mgmt.eventgrid.models.PartnerTopicActivationState + :keyword 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. + :paramtype partner_topic_friendly_description: str + :keyword message_for_activation: Context or helpful message that can be used during the + approval process by the subscriber. + :paramtype message_for_activation: str + """ + super(PartnerTopic, self).__init__(location=location, tags=tags, **kwargs) + self.system_data = None + self.identity = identity + self.partner_registration_immutable_id = partner_registration_immutable_id + self.source = source + self.event_type_info = event_type_info + 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 + self.message_for_activation = message_for_activation + + +class PartnerTopicInfo(msrest.serialization.Model): + """Properties of the corresponding partner topic of a Channel. + + :ivar azure_subscription_id: Azure subscription ID of the subscriber. The partner topic + associated with the channel will be + created under this Azure subscription. + :vartype azure_subscription_id: str + :ivar resource_group_name: Azure Resource Group of the subscriber. The partner topic associated + with the channel will be + created under this resource group. + :vartype resource_group_name: str + :ivar name: Name of the partner topic associated with the channel. + :vartype name: str + :ivar event_type_info: Event Type Information for the partner topic. This information is + provided by the publisher and can be used by the + subscriber to view different types of events that are published. + :vartype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo + :ivar source: The source information is provided by the publisher to determine the scope or + context from which the events + are originating. This information can be used by the subscriber during the approval process of + the + created partner topic. + :vartype source: str + """ + + _attribute_map = { + 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'event_type_info': {'key': 'eventTypeInfo', 'type': 'EventTypeInfo'}, + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__( + self, + *, + azure_subscription_id: Optional[str] = None, + resource_group_name: Optional[str] = None, + name: Optional[str] = None, + event_type_info: Optional["EventTypeInfo"] = None, + source: Optional[str] = None, + **kwargs + ): + """ + :keyword azure_subscription_id: Azure subscription ID of the subscriber. The partner topic + associated with the channel will be + created under this Azure subscription. + :paramtype azure_subscription_id: str + :keyword resource_group_name: Azure Resource Group of the subscriber. The partner topic + associated with the channel will be + created under this resource group. + :paramtype resource_group_name: str + :keyword name: Name of the partner topic associated with the channel. + :paramtype name: str + :keyword event_type_info: Event Type Information for the partner topic. This information is + provided by the publisher and can be used by the + subscriber to view different types of events that are published. + :paramtype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo + :keyword source: The source information is provided by the publisher to determine the scope or + context from which the events + are originating. This information can be used by the subscriber during the approval process of + the + created partner topic. + :paramtype source: str + """ + super(PartnerTopicInfo, self).__init__(**kwargs) + self.azure_subscription_id = azure_subscription_id + self.resource_group_name = resource_group_name + self.name = name + self.event_type_info = event_type_info + self.source = source + + +class PartnerTopicsListResult(msrest.serialization.Model): + """Result of the List Partner Topics operation. + + :ivar value: A collection of partner topics. + :vartype value: list[~azure.mgmt.eventgrid.models.PartnerTopic] + :ivar next_link: A link for the next page of partner topics. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PartnerTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PartnerTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: A collection of partner topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.PartnerTopic] + :keyword next_link: A link for the next page of partner topics. + :paramtype next_link: str + """ + super(PartnerTopicsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartnerTopicUpdateParameters(msrest.serialization.Model): + """Properties of the Partner Topic update. + + :ivar tags: A set of tags. Tags of the Partner Topic resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the Partner Topic resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } def __init__( self, *, - name: Optional[str] = None, - display: Optional["OperationInfo"] = None, - origin: Optional[str] = None, - properties: Optional[Any] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["IdentityInfo"] = None, **kwargs ): """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.eventgrid.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: any + :keyword tags: A set of tags. Tags of the Partner Topic resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the Partner Topic resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ - super(Operation, self).__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties + super(PartnerTopicUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.identity = identity -class OperationInfo(msrest.serialization.Model): - """Information about an operation. +class PartnerUpdateDestinationInfo(msrest.serialization.Model): + """Properties of the corresponding partner destination of a Channel. - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :vartype operation: str - :ivar description: Description of the operation. - :vartype description: str + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: WebhookUpdatePartnerDestinationInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar endpoint_type: Required. Type of the endpoint for the partner destination.Constant filled + by server. Possible values include: "WebHook". + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.PartnerEndpointType """ + _validation = { + 'endpoint_type': {'required': True}, + } + _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + } + + _subtype_map = { + 'endpoint_type': {'WebHook': 'WebhookUpdatePartnerDestinationInfo'} } def __init__( self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, **kwargs ): """ - :keyword provider: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :paramtype operation: str - :keyword description: Description of the operation. - :paramtype description: str """ - super(OperationInfo, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + super(PartnerUpdateDestinationInfo, self).__init__(**kwargs) + self.endpoint_type = None # type: Optional[str] -class OperationsListResult(msrest.serialization.Model): - """Result of the List Operations operation. +class PartnerUpdateTopicInfo(msrest.serialization.Model): + """Update properties for the corresponding partner topic of a channel. - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.eventgrid.models.Operation] + :ivar event_type_info: Event type info for the partner topic. + :vartype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, + 'event_type_info': {'key': 'eventTypeInfo', 'type': 'EventTypeInfo'}, } def __init__( self, *, - value: Optional[List["Operation"]] = None, + event_type_info: Optional["EventTypeInfo"] = None, **kwargs ): """ - :keyword value: A collection of operations. - :paramtype value: list[~azure.mgmt.eventgrid.models.Operation] + :keyword event_type_info: Event type info for the partner topic. + :paramtype event_type_info: ~azure.mgmt.eventgrid.models.EventTypeInfo """ - super(OperationsListResult, self).__init__(**kwargs) - self.value = value + super(PartnerUpdateTopicInfo, self).__init__(**kwargs) + self.event_type_info = event_type_info class PrivateEndpoint(msrest.serialization.Model): @@ -2780,6 +4974,72 @@ def __init__( self.next_link = next_link +class ResourceMoveChangeHistory(msrest.serialization.Model): + """The change history of the resource move. + + :ivar azure_subscription_id: Azure subscription ID of the resource. + :vartype azure_subscription_id: str + :ivar resource_group_name: Azure Resource Group of the resource. + :vartype resource_group_name: str + :ivar changed_time_utc: UTC timestamp of when the resource was changed. + :vartype changed_time_utc: ~datetime.datetime + """ + + _attribute_map = { + 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'changed_time_utc': {'key': 'changedTimeUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + azure_subscription_id: Optional[str] = None, + resource_group_name: Optional[str] = None, + changed_time_utc: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword azure_subscription_id: Azure subscription ID of the resource. + :paramtype azure_subscription_id: str + :keyword resource_group_name: Azure Resource Group of the resource. + :paramtype resource_group_name: str + :keyword changed_time_utc: UTC timestamp of when the resource was changed. + :paramtype changed_time_utc: ~datetime.datetime + """ + super(ResourceMoveChangeHistory, self).__init__(**kwargs) + self.azure_subscription_id = azure_subscription_id + self.resource_group_name = resource_group_name + self.changed_time_utc = changed_time_utc + + +class ResourceSku(msrest.serialization.Model): + """Describes an EventGrid Resource Sku. + + :ivar name: The Sku name of the resource. The possible values are: Basic or Premium. Possible + values include: "Basic", "Premium". Default value: "Basic". + :vartype name: str or ~azure.mgmt.eventgrid.models.Sku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "Sku"]] = "Basic", + **kwargs + ): + """ + :keyword name: The Sku name of the resource. The possible values are: Basic or Premium. + Possible values include: "Basic", "Premium". Default value: "Basic". + :paramtype name: str or ~azure.mgmt.eventgrid.models.Sku + """ + super(ResourceSku, self).__init__(**kwargs) + self.name = name + + class RetryPolicy(msrest.serialization.Model): """Information about the retry policy for an event subscription. @@ -2819,7 +5079,8 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): :ivar 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". + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction", + "PartnerDestination". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. @@ -2867,7 +5128,8 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): :ivar 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". + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction", + "PartnerDestination". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. @@ -3011,7 +5273,8 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): :ivar 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". + "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction", + "PartnerDestination". :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType :ivar resource_id: The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. @@ -3508,10 +5771,10 @@ class SystemTopic(TrackedResource): :vartype location: str :ivar tags: A set of tags. Tags of the resource. :vartype tags: dict[str, str] - :ivar identity: Identity information for the resource. - :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar system_data: The system metadata relating to System Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :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 @@ -3539,8 +5802,8 @@ class SystemTopic(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'source': {'key': 'properties.source', 'type': 'str'}, 'topic_type': {'key': 'properties.topicType', 'type': 'str'}, @@ -3570,8 +5833,8 @@ def __init__( :paramtype topic_type: str """ super(SystemTopic, self).__init__(location=location, tags=tags, **kwargs) - self.identity = identity self.system_data = None + self.identity = identity self.provisioning_state = None self.source = source self.topic_type = topic_type @@ -3659,8 +5922,15 @@ class Topic(TrackedResource): :vartype location: str :ivar tags: A set of tags. Tags of the resource. :vartype tags: dict[str, str] + :ivar sku: The Sku pricing tier for the topic. + :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar identity: Identity information for the resource. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar kind: Kind of the resource. Possible values include: "Azure", "AzureArc". Default value: + "Azure". + :vartype kind: str or ~azure.mgmt.eventgrid.models.ResourceKind + :ivar extended_location: Extended location of the resource. + :vartype extended_location: ~azure.mgmt.eventgrid.models.ExtendedLocation :ivar system_data: The system metadata relating to Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: @@ -3694,6 +5964,9 @@ class Topic(TrackedResource): is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. :vartype disable_local_auth: bool + :ivar data_residency_boundary: Data Residency Boundary of the resource. Possible values + include: "WithinGeopair", "WithinRegion". + :vartype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ _validation = { @@ -3714,7 +5987,10 @@ class Topic(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -3725,6 +6001,7 @@ class Topic(TrackedResource): 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'data_residency_boundary': {'key': 'properties.dataResidencyBoundary', 'type': 'str'}, } def __init__( @@ -3732,12 +6009,16 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + sku: Optional["ResourceSku"] = None, identity: Optional["IdentityInfo"] = None, + kind: Optional[Union[str, "ResourceKind"]] = "Azure", + extended_location: Optional["ExtendedLocation"] = 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, disable_local_auth: Optional[bool] = False, + data_residency_boundary: Optional[Union[str, "DataResidencyBoundary"]] = None, **kwargs ): """ @@ -3745,8 +6026,15 @@ def __init__( :paramtype location: str :keyword tags: A set of tags. Tags of the resource. :paramtype tags: dict[str, str] + :keyword sku: The Sku pricing tier for the topic. + :paramtype sku: ~azure.mgmt.eventgrid.models.ResourceSku :keyword identity: Identity information for the resource. :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword kind: Kind of the resource. Possible values include: "Azure", "AzureArc". Default + value: "Azure". + :paramtype kind: str or ~azure.mgmt.eventgrid.models.ResourceKind + :keyword extended_location: Extended location of the resource. + :paramtype extended_location: ~azure.mgmt.eventgrid.models.ExtendedLocation :keyword 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". @@ -3768,9 +6056,15 @@ def __init__( value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. :paramtype disable_local_auth: bool + :keyword data_residency_boundary: Data Residency Boundary of the resource. Possible values + include: "WithinGeopair", "WithinRegion". + :paramtype data_residency_boundary: str or ~azure.mgmt.eventgrid.models.DataResidencyBoundary """ super(Topic, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku self.identity = identity + self.kind = kind + self.extended_location = extended_location self.system_data = None self.private_endpoint_connections = None self.provisioning_state = None @@ -3781,6 +6075,7 @@ def __init__( self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules self.disable_local_auth = disable_local_auth + self.data_residency_boundary = data_residency_boundary class TopicRegenerateKeyRequest(msrest.serialization.Model): @@ -4003,10 +6298,12 @@ def __init__( class TopicUpdateParameters(msrest.serialization.Model): """Properties of the Topic update. - :ivar tags: A set of tags. Tags of the resource. + :ivar tags: A set of tags. Tags of the Topic resource. :vartype tags: dict[str, str] :ivar identity: Topic resource identity information. :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar sku: The Sku pricing tier for the topic. + :vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku :ivar 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:` HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_partner_namespace_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ChannelsOperations(object): + """ChannelsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> "_models.Channel": + """Get a channel. + + Get properties of a channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Channel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Channel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Channel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('Channel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + channel_info: "_models.Channel", + **kwargs: Any + ) -> "_models.Channel": + """Create or update a channel. + + Synchronously creates or updates a new channel with the specified parameters. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :param channel_info: Channel information. + :type channel_info: ~azure.mgmt.eventgrid.models.Channel + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Channel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.Channel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Channel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(channel_info, 'Channel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('Channel', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Channel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a channel. + + Delete an existing channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + channel_update_parameters: "_models.ChannelUpdateParameters", + **kwargs: Any + ) -> None: + """Update a Channel. + + Synchronously updates a channel with the specified parameters. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the channel. + :type channel_name: str + :param channel_update_parameters: Channel update information. + :type channel_update_parameters: ~azure.mgmt.eventgrid.models.ChannelUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(channel_update_parameters, 'ChannelUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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) + + if cls: + return cls(pipeline_response, None, {}) + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}'} # type: ignore + + + @distributed_trace + def list_by_partner_namespace( + self, + resource_group_name: str, + partner_namespace_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ChannelsListResult"]: + """List channels. + + List all the channels in a partner namespace. + + :param resource_group_name: The name of the resource group within the partners 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ChannelsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.ChannelsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ChannelsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=self.list_by_partner_namespace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ChannelsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels'} # type: ignore + + @distributed_trace + def get_full_url( + self, + resource_group_name: str, + partner_namespace_name: str, + channel_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of partner destination channel. + + Get the full endpoint URL of a partner destination channel. + + :param resource_group_name: The name of the resource group within the partners subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param channel_name: Name of the Channel. + :type channel_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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + channel_name=channel_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}/getFullUrl'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py new file mode 100644 index 000000000000..a8d26d6ed4fa --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py @@ -0,0 +1,930 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class DomainEventSubscriptionsOperations(object): + """DomainEventSubscriptionsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a domain. + + Get properties of an event subscription 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 partner topic. + :type domain_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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Create or update an event subscription to a domain. + + Asynchronously creates a new event subscription or updates an existing event 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 topic. + :type domain_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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete an event subscription for a domain. + + Delete an existing event subscription 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 event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Update an event subscription for a domain. + + Update an existing event subscription for a 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 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace + def get_full_url( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of an event subscription for domain. + + Get the full endpoint URL for an event subscription for 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 topic. + :type domain_name: 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: + """List all event subscriptions for a specific domain. + + 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 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: 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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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 None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions'} # type: ignore + + @distributed_trace + def get_delivery_attributes( + self, + resource_group_name: str, + domain_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for domain. + + Get all delivery attributes for an event subscription for 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 topic. + :type domain_name: 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..10ff2b4918a4 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py @@ -0,0 +1,978 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class DomainTopicEventSubscriptionsOperations(object): + """DomainTopicEventSubscriptionsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get a nested event subscription for domain topic. + + Get properties of a nested event subscription for 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 top level domain. + :type domain_name: str + :param topic_name: Name of the domain topic. + :type topic_name: 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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Create or update a nested event subscription to a domain topic. + + Asynchronously creates a new event subscription or updates an existing event 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 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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a nested event subscription for a domain topic. + + Delete a nested existing event subscription for 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 top level domain. + :type domain_name: str + :param topic_name: Name of the domain topic. + :type topic_name: str + :param event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Update a nested event subscription for a domain topic. + + Update an existing event subscription for 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 topic_name: Name of the topic. + :type topic_name: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_initial( + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace + def get_full_url( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of a nested event subscription for domain topic. + + Get the full endpoint URL for a nested event subscription for 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 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: + """List all nested 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 + :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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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 None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions'} # type: ignore + + @distributed_trace + def get_delivery_attributes( + self, + resource_group_name: str, + domain_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for domain topic. + + Get all delivery attributes for an event subscription for 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 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + 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 d172596cdbb6..3ce9cbcc452d 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,26 +22,20 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') @@ -72,14 +66,13 @@ def build_get_request( def build_create_or_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') @@ -110,14 +103,13 @@ def build_create_or_update_request_initial( def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') path_format_arguments = { @@ -142,16 +134,15 @@ def build_delete_request_initial( def build_list_by_domain_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics') @@ -183,7 +174,6 @@ def build_list_by_domain_request( **kwargs ) -# fmt: on class DomainTopicsOperations(object): """DomainTopicsOperations operations. @@ -209,12 +199,11 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DomainTopic" + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any + ) -> "_models.DomainTopic": """Get a domain topic. Get properties of a domain topic. @@ -266,12 +255,11 @@ def get( def _create_or_update_initial( self, - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DomainTopic" + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any + ) -> "_models.DomainTopic": cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainTopic"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -309,12 +297,11 @@ def _create_or_update_initial( @distributed_trace 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"] + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any + ) -> LROPoller["_models.DomainTopic"]: """Create or update a domain topic. Asynchronously creates or updates a new domain topic with the specified parameters. @@ -380,12 +367,11 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -419,12 +405,11 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - domain_name, # type: str - domain_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + domain_name: str, + domain_topic_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a domain topic. Delete existing domain topic. @@ -487,13 +472,12 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_by_domain( 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"] + resource_group_name: str, + domain_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DomainTopicsListResult"]: """List domain topics. List all the topics in a domain. 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 b91e5c005869..b1f15787c194 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,25 +22,20 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') @@ -70,15 +65,17 @@ def build_get_request( def build_create_or_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') @@ -105,18 +102,19 @@ def build_create_or_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') path_format_arguments = { @@ -140,15 +138,17 @@ def build_delete_request_initial( def build_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') @@ -175,19 +175,20 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_list_by_subscription_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains') @@ -219,15 +220,14 @@ def build_list_by_subscription_request( def build_list_by_resource_group_request( - subscription_id, # type: str - resource_group_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains') @@ -260,13 +260,12 @@ def build_list_by_resource_group_request( def build_list_shared_access_keys_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys') @@ -296,15 +295,17 @@ def build_list_shared_access_keys_request( def build_regenerate_key_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey') @@ -331,10 +332,11 @@ def build_regenerate_key_request( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) -# fmt: on class DomainsOperations(object): """DomainsOperations operations. @@ -360,11 +362,10 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Domain" + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.Domain": """Get a domain. Get properties of a domain. @@ -413,12 +414,11 @@ def get( def _create_or_update_initial( self, - resource_group_name, # type: str - domain_name, # type: str - domain_info, # type: "_models.Domain" - **kwargs # type: Any - ): - # type: (...) -> "_models.Domain" + resource_group_name: str, + domain_name: str, + domain_info: "_models.Domain", + **kwargs: Any + ) -> "_models.Domain": cls = kwargs.pop('cls', None) # type: ClsType["_models.Domain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -460,12 +460,11 @@ def _create_or_update_initial( @distributed_trace 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"] + resource_group_name: str, + domain_name: str, + domain_info: "_models.Domain", + **kwargs: Any + ) -> LROPoller["_models.Domain"]: """Create or update a domain. Asynchronously creates or updates a new domain with the specified parameters. @@ -532,11 +531,10 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -569,11 +567,10 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a domain. Delete existing domain. @@ -632,12 +629,11 @@ def get_long_running_output(pipeline_response): def _update_initial( self, - resource_group_name, # type: str - domain_name, # type: str - domain_update_parameters, # type: "_models.DomainUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Domain"] + resource_group_name: str, + domain_name: str, + domain_update_parameters: "_models.DomainUpdateParameters", + **kwargs: Any + ) -> Optional["_models.Domain"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Domain"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -681,12 +677,11 @@ def _update_initial( @distributed_trace 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"] + resource_group_name: str, + domain_name: str, + domain_update_parameters: "_models.DomainUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Domain"]: """Update a domain. Asynchronously updates a domain with the specified parameters. @@ -754,11 +749,10 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_by_subscription( self, - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DomainsListResult"] + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DomainsListResult"]: """List domains under an Azure subscription. List all the domains under an Azure subscription. @@ -837,12 +831,11 @@ def get_next(next_link=None): @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DomainsListResult"] + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DomainsListResult"]: """List domains under a resource group. List all the domains under a resource group. @@ -925,11 +918,10 @@ def get_next(next_link=None): @distributed_trace def list_shared_access_keys( self, - resource_group_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DomainSharedAccessKeys" + resource_group_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.DomainSharedAccessKeys": """List keys for a domain. List the two keys used to publish to a domain. @@ -979,12 +971,11 @@ def list_shared_access_keys( @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - domain_name, # type: str - regenerate_key_request, # type: "_models.DomainRegenerateKeyRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.DomainSharedAccessKeys" + resource_group_name: str, + domain_name: str, + regenerate_key_request: "_models.DomainRegenerateKeyRequest", + **kwargs: Any + ) -> "_models.DomainSharedAccessKeys": """Regenerate key for a domain. Regenerate a shared access key for a domain. 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 new file mode 100644 index 000000000000..948a85278ed3 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py @@ -0,0 +1,526 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "eventChannelName": _SERIALIZER.url("event_channel_name", event_channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "eventChannelName": _SERIALIZER.url("event_channel_name", event_channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + "eventChannelName": _SERIALIZER.url("event_channel_name", event_channel_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_partner_namespace_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class EventChannelsOperations(object): + """EventChannelsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> "_models.EventChannel": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventChannel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventChannel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventChannel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + event_channel_info: "_models.EventChannel", + **kwargs: Any + ) -> "_models.EventChannel": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventChannel, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.EventChannel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_channel_info, 'EventChannel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventChannel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + event_channel_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + event_channel_name=event_channel_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} # type: ignore + + @distributed_trace + def list_by_partner_namespace( + self, + resource_group_name: str, + partner_namespace_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventChannelsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventChannelsListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventChannelsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventChannelsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=self.list_by_partner_namespace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_namespace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EventChannelsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py index 4d3ca7bf1d54..713fb3f6d893 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,24 +22,19 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + scope: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') @@ -68,14 +63,16 @@ def build_get_request( def build_create_or_update_request_initial( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + scope: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') @@ -101,17 +98,18 @@ def build_create_or_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + scope: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') path_format_arguments = { @@ -134,14 +132,16 @@ def build_delete_request_initial( def build_update_request_initial( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + scope: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') @@ -167,17 +167,18 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_get_full_url_request( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + scope: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl') @@ -206,14 +207,13 @@ def build_get_full_url_request( def build_list_global_by_subscription_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions') @@ -245,15 +245,14 @@ def build_list_global_by_subscription_request( def build_list_global_by_subscription_for_topic_type_request( - subscription_id, # type: str - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + topic_type_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions') @@ -286,15 +285,14 @@ def build_list_global_by_subscription_for_topic_type_request( def build_list_global_by_resource_group_request( - subscription_id, # type: str - resource_group_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions') @@ -327,16 +325,15 @@ def build_list_global_by_resource_group_request( def build_list_global_by_resource_group_for_topic_type_request( - subscription_id, # type: str - resource_group_name, # type: str - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + topic_type_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions') @@ -370,15 +367,14 @@ def build_list_global_by_resource_group_for_topic_type_request( def build_list_regional_by_subscription_request( - subscription_id, # type: str - location, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + location: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions') @@ -411,16 +407,15 @@ def build_list_regional_by_subscription_request( def build_list_regional_by_resource_group_request( - subscription_id, # type: str - resource_group_name, # type: str - location, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + location: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions') @@ -454,16 +449,15 @@ def build_list_regional_by_resource_group_request( def build_list_regional_by_subscription_for_topic_type_request( - subscription_id, # type: str - location, # type: str - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + location: str, + topic_type_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions') @@ -497,17 +491,16 @@ def build_list_regional_by_subscription_for_topic_type_request( def build_list_regional_by_resource_group_for_topic_type_request( - subscription_id, # type: str - resource_group_name, # type: str - location, # type: str - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + location: str, + topic_type_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions') @@ -542,18 +535,17 @@ def build_list_regional_by_resource_group_for_topic_type_request( def build_list_by_resource_request( - subscription_id, # type: str - resource_group_name, # type: str - provider_namespace, # type: str - resource_type_name, # type: str - resource_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions') @@ -589,17 +581,16 @@ def build_list_by_resource_request( def build_list_by_domain_topic_request( - subscription_id, # type: str - resource_group_name, # type: str - domain_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + domain_name: str, + topic_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions') @@ -634,12 +625,11 @@ def build_list_by_domain_topic_request( def build_get_delivery_attributes_request( - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + scope: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') @@ -666,7 +656,6 @@ def build_get_delivery_attributes_request( **kwargs ) -# fmt: on class EventSubscriptionsOperations(object): """EventSubscriptionsOperations operations. @@ -692,11 +681,10 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + scope: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": """Get an event subscription. Get properties of an event subscription. @@ -751,12 +739,11 @@ def get( def _create_or_update_initial( self, - scope, # type: str - event_subscription_name, # type: str - event_subscription_info, # type: "_models.EventSubscription" - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + scope: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_models.EventSubscription": cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -797,12 +784,11 @@ def _create_or_update_initial( @distributed_trace 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"] + scope: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: """Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based @@ -881,11 +867,10 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + scope: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -917,11 +902,10 @@ def _delete_initial( @distributed_trace def begin_delete( self, - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + scope: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete an event subscription. Delete an existing event subscription. @@ -987,12 +971,11 @@ def get_long_running_output(pipeline_response): def _update_initial( self, - scope, # type: str - event_subscription_name, # type: str - event_subscription_update_parameters, # type: "_models.EventSubscriptionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + scope: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_models.EventSubscription": cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1033,12 +1016,11 @@ def _update_initial( @distributed_trace 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"] + scope: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: """Update an event subscription. Asynchronously updates an existing event subscription. @@ -1115,11 +1097,10 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_full_url( self, - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscriptionFullUrl" + scope: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": """Get full URL of an event subscription. Get the full endpoint URL for an event subscription. @@ -1175,11 +1156,10 @@ def get_full_url( @distributed_trace def list_global_by_subscription( self, - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -1259,12 +1239,11 @@ def get_next(next_link=None): @distributed_trace def list_global_by_subscription_for_topic_type( self, - topic_type_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -1348,12 +1327,11 @@ def get_next(next_link=None): @distributed_trace def list_global_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -1437,13 +1415,12 @@ def get_next(next_link=None): @distributed_trace def list_global_by_resource_group_for_topic_type( 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"] + resource_group_name: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -1531,12 +1508,11 @@ def get_next(next_link=None): @distributed_trace def list_regional_by_subscription( self, - location, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] + location: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -1620,13 +1596,12 @@ def get_next(next_link=None): @distributed_trace def list_regional_by_resource_group( 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"] + resource_group_name: str, + location: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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 @@ -1715,13 +1690,12 @@ def get_next(next_link=None): @distributed_trace def list_regional_by_subscription_for_topic_type( 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"] + location: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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 @@ -1810,14 +1784,13 @@ def get_next(next_link=None): @distributed_trace def list_regional_by_resource_group_for_topic_type( 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"] + resource_group_name: str, + location: str, + topic_type_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: """List all regional event subscriptions under an Azure subscription and resource group for a topic type. @@ -1911,18 +1884,17 @@ def get_next(next_link=None): @distributed_trace def list_by_resource( 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. + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: + """List all event subscriptions. + + List all event subscriptions that have been created for a specific resource. :param resource_group_name: The name of the resource group within the user's subscription. :type resource_group_name: str @@ -2015,14 +1987,13 @@ def get_next(next_link=None): @distributed_trace def list_by_domain_topic( 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"] + resource_group_name: str, + domain_name: str, + topic_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> 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. @@ -2114,11 +2085,10 @@ def get_next(next_link=None): @distributed_trace def get_delivery_attributes( self, - scope, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeliveryAttributeListResult" + scope: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": """Get delivery attributes for an event subscription. Get all delivery attributes for an event subscription. diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py index ef52811d9820..653c22eae593 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -19,23 +19,17 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - scope, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + scope: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default') @@ -61,7 +55,6 @@ def build_get_request( **kwargs ) -# fmt: on class ExtensionTopicsOperations(object): """ExtensionTopicsOperations operations. @@ -87,10 +80,9 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - scope, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionTopic" + scope: str, + **kwargs: Any + ) -> "_models.ExtensionTopic": """Get properties of an extension topic. Get the properties of an extension topic. 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 2095a18b040f..ffc52e5ac118 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -20,22 +20,16 @@ from .. import models as _models from .._vendor import _convert_request - -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]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/operations') @@ -56,7 +50,6 @@ def build_list_request( **kwargs ) -# fmt: on class Operations(object): """Operations operations. @@ -82,9 +75,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationsListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationsListResult"]: """List available operations. List the available operations supported by the Microsoft.EventGrid resource provider. diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py new file mode 100644 index 000000000000..4626cec4dbc6 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py @@ -0,0 +1,994 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_authorize_partner_request( + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/authorizePartner') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_unauthorize_partner_request( + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/unauthorizePartner') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class PartnerConfigurationsOperations(object): + """PartnerConfigurationsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Get a partner configuration. + + Get properties of a partner configuration. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + partner_configuration_info: "_models.PartnerConfiguration", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_configuration_info, 'PartnerConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + partner_configuration_info: "_models.PartnerConfiguration", + **kwargs: Any + ) -> LROPoller["_models.PartnerConfiguration"]: + """Create or update a partner configuration. + + Synchronously creates or updates a partner configuration 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_configuration_info: Partner configuration information. + :type partner_configuration_info: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerConfiguration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + partner_configuration_info=partner_configuration_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerConfigurations/default'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a partner configuration. + + Delete existing partner configuration. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerConfigurations/default'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + partner_configuration_update_parameters: "_models.PartnerConfigurationUpdateParameters", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_configuration_update_parameters, 'PartnerConfigurationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + partner_configuration_update_parameters: "_models.PartnerConfigurationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.PartnerConfiguration"]: + """Update a partner configuration. + + Synchronously updates a partner configuration 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_configuration_update_parameters: Partner configuration update information. + :type partner_configuration_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerConfigurationUpdateParameters + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerConfiguration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + 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 = self._update_initial( + resource_group_name=resource_group_name, + partner_configuration_update_parameters=partner_configuration_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerConfiguration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerConfigurations/default'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PartnerConfigurationsListResult"]: + """List partner configurations under a resource group. + + List all the partner configurations under a resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerConfigurationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerConfigurationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerConfigurationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerConfigurationsListResult"]: + """List partner configurations under an Azure subscription. + + List all the partner configurations 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 PartnerConfigurationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerConfigurationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfigurationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerConfigurationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations'} # type: ignore + + @distributed_trace + def authorize_partner( + self, + resource_group_name: str, + partner_info: "_models.Partner", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Authorize a partner. + + Authorize a single partner either by partner registration immutable Id or by partner name. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_info: The information of the partner to be authorized. + :type partner_info: ~azure.mgmt.eventgrid.models.Partner + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_info, 'Partner') + + request = build_authorize_partner_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.authorize_partner.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + authorize_partner.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/authorizePartner'} # type: ignore + + + @distributed_trace + def unauthorize_partner( + self, + resource_group_name: str, + partner_info: "_models.Partner", + **kwargs: Any + ) -> "_models.PartnerConfiguration": + """Unauthorize a partner. + + Unauthorize a single partner either by partner registration immutable Id or by partner name. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_info: The information of the partner to be unauthorized. + :type partner_info: ~azure.mgmt.eventgrid.models.Partner + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_info, 'Partner') + + request = build_unauthorize_partner_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.unauthorize_partner.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + unauthorize_partner.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/unauthorizePartner'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py new file mode 100644 index 000000000000..0eb35cbf5aad --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py @@ -0,0 +1,822 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerDestinationName": _SERIALIZER.url("partner_destination_name", partner_destination_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + partner_destination_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerDestinationName": _SERIALIZER.url("partner_destination_name", partner_destination_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerDestinationName": _SERIALIZER.url("partner_destination_name", partner_destination_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + partner_destination_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerDestinationName": _SERIALIZER.url("partner_destination_name", partner_destination_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_activate_request( + subscription_id: str, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerDestinationName": _SERIALIZER.url("partner_destination_name", partner_destination_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PartnerDestinationsOperations(object): + """PartnerDestinationsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> "_models.PartnerDestination": + """Get a partner destination. + + Get properties of a partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + partner_destination_name: str, + partner_destination: "_models.PartnerDestination", + **kwargs: Any + ) -> "_models.PartnerDestination": + """Create a partner destination. + + Asynchronously creates a new partner destination 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_destination_name: Name of the partner destination. + :type partner_destination_name: str + :param partner_destination: Partner destination create information. + :type partner_destination: ~azure.mgmt.eventgrid.models.PartnerDestination + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_destination, 'PartnerDestination') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerDestination', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a partner destination. + + Delete existing partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerDestinations/{partnerDestinationName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + partner_destination_name: str, + partner_destination_update_parameters: "_models.PartnerDestinationUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerDestination"]: + """Update a partner destination. + + Asynchronously updates a partner destination 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_destination_name: Name of the partner destination. + :type partner_destination_name: str + :param partner_destination_update_parameters: Partner destination update information. + :type partner_destination_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerDestinationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerDestination"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_destination_update_parameters, 'PartnerDestinationUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}'} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerDestinationsListResult"]: + """List partner destinations under an Azure subscription. + + List all the partner destinations 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 PartnerDestinationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerDestinationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestinationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerDestinationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerDestinationsListResult"]: + """List partner destinations under a resource group. + + List all the partner destinations 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 PartnerDestinationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerDestinationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestinationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerDestinationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations'} # type: ignore + + @distributed_trace + def activate( + self, + resource_group_name: str, + partner_destination_name: str, + **kwargs: Any + ) -> "_models.PartnerDestination": + """Activate a partner destination. + + Activate a newly created partner destination. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param partner_destination_name: Name of the partner destination. + :type partner_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerDestination, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerDestination"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_activate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_destination_name=partner_destination_name, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerDestination', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate'} # 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 new file mode 100644 index 000000000000..a8ab539213e4 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py @@ -0,0 +1,1035 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_shared_access_keys_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + subscription_id: str, + resource_group_name: str, + partner_namespace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerNamespaceName": _SERIALIZER.url("partner_namespace_name", partner_namespace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class PartnerNamespacesOperations(object): + """PartnerNamespacesOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> "_models.PartnerNamespace": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_info: "_models.PartnerNamespace", + **kwargs: Any + ) -> "_models.PartnerNamespace": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_namespace_info, 'PartnerNamespace') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_info: "_models.PartnerNamespace", + **kwargs: Any + ) -> LROPoller["_models.PartnerNamespace"]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + partner_namespace_info=partner_namespace_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerNamespace', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_update_parameters: "_models.PartnerNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_namespace_update_parameters, 'PartnerNamespaceUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + partner_namespace_name: str, + partner_namespace_update_parameters: "_models.PartnerNamespaceUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.PartnerNamespace"]: + """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 partner_namespace_update_parameters: Partner namespace update information. + :type partner_namespace_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerNamespaceUpdateParameters + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerNamespace or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespace"] + 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 = self._update_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + partner_namespace_update_parameters=partner_namespace_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerNamespace', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerNamespaces/{partnerNamespaceName}'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerNamespacesListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerNamespacesListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerNamespacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerNamespacesListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerNamespacesListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerNamespacesListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerNamespacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerNamespacesListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces'} # type: ignore + + @distributed_trace + def list_shared_access_keys( + self, + resource_group_name: str, + partner_namespace_name: str, + **kwargs: Any + ) -> "_models.PartnerNamespaceSharedAccessKeys": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespaceSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespaceSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerNamespaceSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys'} # type: ignore + + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + partner_namespace_name: str, + regenerate_key_request: "_models.PartnerNamespaceRegenerateKeyRequest", + **kwargs: Any + ) -> "_models.PartnerNamespaceSharedAccessKeys": + """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 regenerate_key_request: Request body to regenerate key. + :type regenerate_key_request: ~azure.mgmt.eventgrid.models.PartnerNamespaceRegenerateKeyRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerNamespaceSharedAccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerNamespaceSharedAccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key_request, 'PartnerNamespaceRegenerateKeyRequest') + + request = build_regenerate_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerNamespaceSharedAccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py new file mode 100644 index 000000000000..3ea6eeaa7459 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py @@ -0,0 +1,848 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerRegistrationName": _SERIALIZER.url("partner_registration_name", partner_registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_registration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerRegistrationName": _SERIALIZER.url("partner_registration_name", partner_registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerRegistrationName": _SERIALIZER.url("partner_registration_name", partner_registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_registration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerRegistrationName": _SERIALIZER.url("partner_registration_name", partner_registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PartnerRegistrationsOperations(object): + """PartnerRegistrationsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> "_models.PartnerRegistration": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerRegistration, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_info: "_models.PartnerRegistration", + **kwargs: Any + ) -> "_models.PartnerRegistration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_registration_info, 'PartnerRegistration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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('PartnerRegistration', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_info: "_models.PartnerRegistration", + **kwargs: Any + ) -> LROPoller["_models.PartnerRegistration"]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerRegistration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + partner_registration_info=partner_registration_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerRegistration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_registration_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_update_parameters: "_models.PartnerRegistrationUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerRegistration"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerRegistration"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_registration_update_parameters, 'PartnerRegistrationUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerRegistration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + partner_registration_name: str, + partner_registration_update_parameters: "_models.PartnerRegistrationUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.PartnerRegistration"]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 PartnerRegistration or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistration"] + 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 = self._update_initial( + resource_group_name=resource_group_name, + partner_registration_name=partner_registration_name, + partner_registration_update_parameters=partner_registration_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PartnerRegistration', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerRegistrations/{partnerRegistrationName}'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerRegistrationsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerRegistrationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerRegistrationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistrationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerRegistrationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerRegistrationsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerRegistrationsListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerRegistrationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerRegistrationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerRegistrationsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations'} # type: ignore 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 new file mode 100644 index 000000000000..718ce13e549d --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py @@ -0,0 +1,961 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_partner_topic_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PartnerTopicEventSubscriptionsOperations(object): + """PartnerTopicEventSubscriptionsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a partner topic. + + Get properties of 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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete an event subscription of a partner topic. + + Delete an existing 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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Update event subscription of a partner topic. + + Update an existing 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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace + def get_full_url( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """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 + :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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list_by_partner_topic( + self, + resource_group_name: str, + partner_topic_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: + """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 + :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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_partner_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + filter=filter, + top=top, + template_url=self.list_by_partner_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_partner_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_partner_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions'} # type: ignore + + @distributed_trace + def get_delivery_attributes( + self, + resource_group_name: str, + partner_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription of a partner topic. + + Get all delivery attributes 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py new file mode 100644 index 000000000000..f925a0d93d31 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py @@ -0,0 +1,908 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_activate_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deactivate_request( + subscription_id: str, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "partnerTopicName": _SERIALIZER.url("partner_topic_name", partner_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PartnerTopicsOperations(object): + """PartnerTopicsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + partner_topic_name: str, + partner_topic_info: "_models.PartnerTopic", + **kwargs: Any + ) -> "_models.PartnerTopic": + """Create a partner topic. + + Asynchronously creates a new 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 partner_topic_info: Partner Topic information. + :type partner_topic_info: ~azure.mgmt.eventgrid.models.PartnerTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_topic_info, 'PartnerTopic') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerTopic', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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/partnerTopics/{partnerTopicName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + partner_topic_name: str, + partner_topic_update_parameters: "_models.PartnerTopicUpdateParameters", + **kwargs: Any + ) -> Optional["_models.PartnerTopic"]: + """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 partner_topic_update_parameters: PartnerTopic update information. + :type partner_topic_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerTopicUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PartnerTopic"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(partner_topic_update_parameters, 'PartnerTopicUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerTopicsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerTopicsListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerTopicsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PartnerTopicsListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PartnerTopicsListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PartnerTopicsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopicsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PartnerTopicsListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics'} # type: ignore + + @distributed_trace + def activate( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_activate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate'} # type: ignore + + + @distributed_trace + def deactivate( + self, + resource_group_name: str, + partner_topic_name: str, + **kwargs: Any + ) -> "_models.PartnerTopic": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PartnerTopic, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PartnerTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_deactivate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + template_url=self.deactivate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('PartnerTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate'} # type: ignore + 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 21eb3fc848d2..3349f8ca8404 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,27 +22,22 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum18"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') @@ -74,17 +69,19 @@ def build_get_request( def build_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum19"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') @@ -113,20 +110,21 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum20"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') path_format_arguments = { @@ -152,17 +150,16 @@ def build_delete_request_initial( def build_list_by_resource_request( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum21"] - parent_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections') @@ -195,7 +192,6 @@ def build_list_by_resource_request( **kwargs ) -# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -221,24 +217,23 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum18"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get a specific private endpoint connection. - Get a specific private endpoint connection under a topic or domain. + Get a specific private endpoint connection under a topic, domain, or partner namespace. :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.Enum18 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -285,14 +280,13 @@ def get( def _update_initial( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum19"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -340,25 +334,24 @@ def _update_initial( @distributed_trace def begin_update( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum19"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update a specific private endpoint connection. - Update a specific private endpoint connection under a topic or domain. + Update a specific private endpoint connection under a topic, domain or partner namespace. :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.Enum19 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -424,13 +417,12 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum20"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -465,24 +457,23 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum20"] - parent_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a specific private endpoint connection. - Delete a specific private endpoint connection under a topic or domain. + Delete a specific private endpoint connection under a topic, domain, or partner namespace. :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.Enum20 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace name). :type parent_name: str :param private_endpoint_connection_name: The name of the private endpoint connection connection. @@ -540,25 +531,24 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_by_resource( self, - resource_group_name, # type: str - parent_type, # type: Union[str, "_models.Enum21"] - parent_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + parent_type: Union[str, "_models.ParentType"], + parent_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """Lists all private endpoint connections under a resource. - Get all private endpoint connections under a topic or domain. + Get all private endpoint connections under a topic, domain, or partner namespace. :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.Enum21 - :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\', + \'domains\', or \'partnerNamespaces\'. + :type parent_type: str or ~azure.mgmt.eventgrid.models.ParentType + :param parent_name: The name of the parent resource (namely, either, the topic name, domain + name, or partner namespace 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 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 e080604250bb..7a6f64e2c8bf 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -20,27 +20,21 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: str - parent_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + parent_type: str, + parent_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}') @@ -72,17 +66,16 @@ def build_get_request( def build_list_by_resource_request( - subscription_id, # type: str - resource_group_name, # type: str - parent_type, # type: str - parent_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + parent_type: str, + parent_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources') @@ -115,7 +108,6 @@ def build_list_by_resource_request( **kwargs ) -# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -141,24 +133,23 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( 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" + resource_group_name: str, + parent_type: str, + parent_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_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\'. + :param parent_type: The type of the parent resource. This can be either \'topics\', + \'domains\', or \'partnerNamespaces\'. :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, domain + name, or partner namespace name). :type parent_name: str :param private_link_resource_name: The name of private link resource. :type private_link_resource_name: str @@ -205,25 +196,24 @@ def get( @distributed_trace def list_by_resource( 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. + resource_group_name: str, + parent_type: str, + parent_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourcesListResult"]: + """List private link resources under specific topic, domain, or partner namespace. + + List all the private link resources under a topic, domain, or partner namespace. :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\', + \'domains\', or \'partnerNamespaces\'. :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, domain + name, or partner namespace 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 diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py index ac624e9144ff..7db927e08773 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,26 +22,21 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') @@ -72,16 +67,18 @@ def build_get_request( def build_create_or_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') @@ -109,19 +106,20 @@ def build_create_or_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') path_format_arguments = { @@ -146,16 +144,18 @@ def build_delete_request_initial( def build_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') @@ -183,19 +183,20 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_get_full_url_request( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') @@ -226,16 +227,15 @@ def build_get_full_url_request( def build_list_by_system_topic_request( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions') @@ -269,14 +269,13 @@ def build_list_by_system_topic_request( def build_get_delivery_attributes_request( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') @@ -305,7 +304,6 @@ def build_get_delivery_attributes_request( **kwargs ) -# fmt: on class SystemTopicEventSubscriptionsOperations(object): """SystemTopicEventSubscriptionsOperations operations. @@ -331,12 +329,11 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": """Get an event subscription of a system topic. Get an event subscription. @@ -390,13 +387,12 @@ def get( def _create_or_update_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - event_subscription_info, # type: "_models.EventSubscription" - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_models.EventSubscription": cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -439,13 +435,12 @@ def _create_or_update_initial( @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - event_subscription_info, # type: "_models.EventSubscription" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.EventSubscription"] + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: """Create or update an event subscription for a system topic. Asynchronously creates or updates an event subscription with the specified parameters. Existing @@ -520,12 +515,11 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -559,15 +553,14 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete an event subscription of a system topic. - Delete an event subscription of a system topic. + Delete an existing 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 @@ -628,13 +621,12 @@ def get_long_running_output(pipeline_response): def _update_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - event_subscription_update_parameters, # type: "_models.EventSubscriptionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscription" + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_models.EventSubscription": cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -677,16 +669,15 @@ def _update_initial( @distributed_trace def begin_update( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - event_subscription_update_parameters, # type: "_models.EventSubscriptionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.EventSubscription"] + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: """Update event subscription of a system topic. - Update event subscription of a system topic. + Update an existing 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 @@ -758,12 +749,11 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_full_url( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EventSubscriptionFullUrl" + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": """Get full URL of an event subscription of a system topic. Get the full endpoint URL for an event subscription of a system topic. @@ -818,13 +808,12 @@ def get_full_url( @distributed_trace def list_by_system_topic( self, - resource_group_name, # type: str - system_topic_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] + resource_group_name: str, + system_topic_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EventSubscriptionsListResult"]: """List event subscriptions of a system topic. List event subscriptions that belong to a specific system topic. @@ -912,12 +901,11 @@ def get_next(next_link=None): @distributed_trace def get_delivery_attributes( self, - resource_group_name, # type: str - system_topic_name, # type: str - event_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeliveryAttributeListResult" + resource_group_name: str, + system_topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": """Get delivery attributes for an event subscription. Get all delivery attributes for an event subscription. diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py index a43cb2f189d2..90ef5d3d91c4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,25 +22,20 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') @@ -70,15 +65,17 @@ def build_get_request( def build_create_or_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') @@ -105,18 +102,19 @@ def build_create_or_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') path_format_arguments = { @@ -140,15 +138,17 @@ def build_delete_request_initial( def build_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + system_topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') @@ -175,19 +175,20 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_list_by_subscription_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics') @@ -219,15 +220,14 @@ def build_list_by_subscription_request( def build_list_by_resource_group_request( - subscription_id, # type: str - resource_group_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics') @@ -258,7 +258,6 @@ def build_list_by_resource_group_request( **kwargs ) -# fmt: on class SystemTopicsOperations(object): """SystemTopicsOperations operations. @@ -284,11 +283,10 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SystemTopic" + resource_group_name: str, + system_topic_name: str, + **kwargs: Any + ) -> "_models.SystemTopic": """Get a system topic. Get properties of a system topic. @@ -337,12 +335,11 @@ def get( def _create_or_update_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - system_topic_info, # type: "_models.SystemTopic" - **kwargs # type: Any - ): - # type: (...) -> "_models.SystemTopic" + resource_group_name: str, + system_topic_name: str, + system_topic_info: "_models.SystemTopic", + **kwargs: Any + ) -> "_models.SystemTopic": cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -388,12 +385,11 @@ def _create_or_update_initial( @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - system_topic_name, # type: str - system_topic_info, # type: "_models.SystemTopic" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SystemTopic"] + resource_group_name: str, + system_topic_name: str, + system_topic_info: "_models.SystemTopic", + **kwargs: Any + ) -> LROPoller["_models.SystemTopic"]: """Create a system topic. Asynchronously creates a new system topic with the specified parameters. @@ -461,11 +457,10 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + system_topic_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -498,11 +493,10 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - system_topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + system_topic_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a system topic. Delete existing system topic. @@ -561,12 +555,11 @@ def get_long_running_output(pipeline_response): def _update_initial( self, - resource_group_name, # type: str - system_topic_name, # type: str - system_topic_update_parameters, # type: "_models.SystemTopicUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.SystemTopic" + resource_group_name: str, + system_topic_name: str, + system_topic_update_parameters: "_models.SystemTopicUpdateParameters", + **kwargs: Any + ) -> "_models.SystemTopic": cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -612,12 +605,11 @@ def _update_initial( @distributed_trace def begin_update( self, - resource_group_name, # type: str - system_topic_name, # type: str - system_topic_update_parameters, # type: "_models.SystemTopicUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SystemTopic"] + resource_group_name: str, + system_topic_name: str, + system_topic_update_parameters: "_models.SystemTopicUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.SystemTopic"]: """Update a system topic. Asynchronously updates a system topic with the specified parameters. @@ -686,11 +678,10 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_by_subscription( self, - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SystemTopicsListResult"] + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SystemTopicsListResult"]: """List system topics under an Azure subscription. List all the system topics under an Azure subscription. @@ -770,12 +761,11 @@ def get_next(next_link=None): @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SystemTopicsListResult"] + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SystemTopicsListResult"]: """List system topics under a resource group. List all the system topics under a resource group. diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..10df707cf79c --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py @@ -0,0 +1,930 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + subscription_id: str, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class TopicEventSubscriptionsOperations(object): + """TopicEventSubscriptionsOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscription": + """Get an event subscription of a topic. + + Get properties of an event subscription 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 partner topic. + :type 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 + :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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('EventSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_info: "_models.EventSubscription", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Create or update an event subscription to a topic. + + Asynchronously creates a new event subscription or updates an existing event 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 domain topic. + :type 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 + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete an event subscription for a topic. + + Delete an existing event subscription 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 event_subscription_name: Name of the event subscription to be deleted. Event + subscription names must be between 3 and 100 characters in length and use alphanumeric letters + only. + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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 + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> "_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + event_subscription_update_parameters: "_models.EventSubscriptionUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.EventSubscription"]: + """Update an event subscription for a topic. + + Update an existing event subscription 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 domain. + :type topic_name: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_initial( + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EventSubscription', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace + def get_full_url( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.EventSubscriptionFullUrl": + """Get full URL of an event subscription for topic. + + Get the full endpoint URL for an event subscription for 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 domain topic. + :type topic_name: 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', {})) + + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> Iterable["_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 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: 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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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 None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions'} # type: ignore + + @distributed_trace + def get_delivery_attributes( + self, + resource_group_name: str, + topic_name: str, + event_subscription_name: str, + **kwargs: Any + ) -> "_models.DeliveryAttributeListResult": + """Get delivery attributes for an event subscription for topic. + + Get all delivery attributes for an event subscription for 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 domain topic. + :type topic_name: 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: DeliveryAttributeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeliveryAttributeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('DeliveryAttributeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + 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 c16e46efab75..3897d3206b84 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -20,22 +20,16 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes') @@ -58,11 +52,10 @@ def build_list_request( def build_get_request( - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + topic_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}') @@ -90,11 +83,10 @@ def build_get_request( def build_list_event_types_request( - topic_type_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + topic_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes') @@ -120,7 +112,6 @@ def build_list_event_types_request( **kwargs ) -# fmt: on class TopicTypesOperations(object): """TopicTypesOperations operations. @@ -146,9 +137,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TopicTypesListResult"] + **kwargs: Any + ) -> Iterable["_models.TopicTypesListResult"]: """List topic types. List all registered topic types. @@ -211,10 +201,9 @@ def get_next(next_link=None): @distributed_trace def get( self, - topic_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TopicTypeInfo" + topic_type_name: str, + **kwargs: Any + ) -> "_models.TopicTypeInfo": """Get a topic type. Get information about a topic type. @@ -260,10 +249,9 @@ def get( @distributed_trace def list_event_types( self, - topic_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EventTypesListResult"] + topic_type_name: str, + **kwargs: Any + ) -> Iterable["_models.EventTypesListResult"]: """List event types. List event types for a topic type. 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 6d0c1d9b0611..545fd1322a31 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,25 +22,20 @@ from .. import models as _models from .._vendor import _convert_request, _format_url_section - -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]] +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_request( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') @@ -70,15 +65,17 @@ def build_get_request( def build_create_or_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') @@ -105,18 +102,19 @@ def build_create_or_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_delete_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') path_format_arguments = { @@ -140,15 +138,17 @@ def build_delete_request_initial( def build_update_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') @@ -175,19 +175,20 @@ def build_update_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_list_by_subscription_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics') @@ -219,15 +220,14 @@ def build_list_by_subscription_request( def build_list_by_resource_group_request( - subscription_id, # type: str - resource_group_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - filter = kwargs.pop('filter', None) # type: Optional[str] - top = kwargs.pop('top', None) # type: Optional[int] - - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics') @@ -260,13 +260,12 @@ def build_list_by_resource_group_request( def build_list_shared_access_keys_request( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + topic_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys') @@ -296,15 +295,17 @@ def build_list_shared_access_keys_request( def build_regenerate_key_request_initial( - subscription_id, # type: str - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, + resource_group_name: str, + topic_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey') @@ -331,20 +332,21 @@ def build_regenerate_key_request_initial( url=url, params=query_parameters, headers=header_parameters, + json=json, + content=content, **kwargs ) def build_list_event_types_request( - subscription_id, # type: str - resource_group_name, # type: str - provider_namespace, # type: str - resource_type_name, # type: str - resource_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - api_version = "2021-12-01" + subscription_id: str, + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes') @@ -374,7 +376,6 @@ def build_list_event_types_request( **kwargs ) -# fmt: on class TopicsOperations(object): """TopicsOperations operations. @@ -400,11 +401,10 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( self, - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Topic" + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.Topic": """Get a topic. Get properties of a topic. @@ -453,12 +453,11 @@ def get( def _create_or_update_initial( self, - resource_group_name, # type: str - topic_name, # type: str - topic_info, # type: "_models.Topic" - **kwargs # type: Any - ): - # type: (...) -> "_models.Topic" + resource_group_name: str, + topic_name: str, + topic_info: "_models.Topic", + **kwargs: Any + ) -> "_models.Topic": cls = kwargs.pop('cls', None) # type: ClsType["_models.Topic"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,12 +499,11 @@ def _create_or_update_initial( @distributed_trace 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"] + resource_group_name: str, + topic_name: str, + topic_info: "_models.Topic", + **kwargs: Any + ) -> LROPoller["_models.Topic"]: """Create a topic. Asynchronously creates a new topic with the specified parameters. @@ -572,11 +570,10 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -609,11 +606,10 @@ def _delete_initial( @distributed_trace def begin_delete( self, - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a topic. Delete existing topic. @@ -672,12 +668,11 @@ def get_long_running_output(pipeline_response): def _update_initial( self, - resource_group_name, # type: str - topic_name, # type: str - topic_update_parameters, # type: "_models.TopicUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Topic"] + resource_group_name: str, + topic_name: str, + topic_update_parameters: "_models.TopicUpdateParameters", + **kwargs: Any + ) -> Optional["_models.Topic"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Topic"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -721,12 +716,11 @@ def _update_initial( @distributed_trace 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"] + resource_group_name: str, + topic_name: str, + topic_update_parameters: "_models.TopicUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Topic"]: """Update a topic. Asynchronously updates a topic with the specified parameters. @@ -794,11 +788,10 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_by_subscription( self, - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TopicsListResult"] + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.TopicsListResult"]: """List topics under an Azure subscription. List all the topics under an Azure subscription. @@ -877,12 +870,11 @@ def get_next(next_link=None): @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TopicsListResult"] + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.TopicsListResult"]: """List topics under a resource group. List all the topics under a resource group. @@ -965,11 +957,10 @@ def get_next(next_link=None): @distributed_trace def list_shared_access_keys( self, - resource_group_name, # type: str - topic_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TopicSharedAccessKeys" + resource_group_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.TopicSharedAccessKeys": """List keys for a topic. List the two keys used to publish to a topic. @@ -1018,13 +1009,12 @@ def list_shared_access_keys( def _regenerate_key_initial( self, - resource_group_name, # type: str - topic_name, # type: str - regenerate_key_request, # type: "_models.TopicRegenerateKeyRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.TopicSharedAccessKeys" - cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicSharedAccessKeys"] + resource_group_name: str, + topic_name: str, + regenerate_key_request: "_models.TopicRegenerateKeyRequest", + **kwargs: Any + ) -> Optional["_models.TopicSharedAccessKeys"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TopicSharedAccessKeys"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1048,11 +1038,13 @@ def _regenerate_key_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -1065,12 +1057,11 @@ def _regenerate_key_initial( @distributed_trace def begin_regenerate_key( self, - resource_group_name, # type: str - topic_name, # type: str - regenerate_key_request, # type: "_models.TopicRegenerateKeyRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.TopicSharedAccessKeys"] + resource_group_name: str, + topic_name: str, + regenerate_key_request: "_models.TopicRegenerateKeyRequest", + **kwargs: Any + ) -> LROPoller["_models.TopicSharedAccessKeys"]: """Regenerate key for a topic. Regenerate a shared access key for a topic. @@ -1139,13 +1130,12 @@ def get_long_running_output(pipeline_response): @distributed_trace def list_event_types( 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"] + resource_group_name: str, + provider_namespace: str, + resource_type_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.EventTypesListResult"]: """List topic event types. List event types for a topic. diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py new file mode 100644 index 000000000000..2190a06081ef --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py @@ -0,0 +1,240 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + verified_partner_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName}') + path_format_arguments = { + "verifiedPartnerName": _SERIALIZER.url("verified_partner_name", verified_partner_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/verifiedPartners') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class VerifiedPartnersOperations(object): + """VerifiedPartnersOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + verified_partner_name: str, + **kwargs: Any + ) -> "_models.VerifiedPartner": + """Get a verified partner. + + Get properties of a verified partner. + + :param verified_partner_name: Name of the verified partner. + :type verified_partner_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VerifiedPartner, or the result of cls(response) + :rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerifiedPartner"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + verified_partner_name=verified_partner_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('VerifiedPartner', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName}'} # type: ignore + + + @distributed_trace + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VerifiedPartnersListResult"]: + """List all verified partners. + + Get a list of all verified partners. + + :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 VerifiedPartnersListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.VerifiedPartnersListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VerifiedPartnersListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VerifiedPartnersListResult", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.EventGrid/verifiedPartners'} # type: ignore diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.pyTestMgmtEventGridtest_domain.json b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.pyTestMgmtEventGridtest_domain.json index de1c3f4254ee..33acc61c7847 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.pyTestMgmtEventGridtest_domain.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.pyTestMgmtEventGridtest_domain.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.6.2 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-identity/1.9.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,13 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:56:54 GMT", + "Date": "Mon, 28 Mar 2022 01:37:10 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12529.17 - SCUS ProdSlices", - "x-ms-request-id": "468d883a-fd65-490e-ab0a-ef77aa0e2001" + "x-ms-ests-server": "2.1.12570.11 - EUS ProdSlices" }, "ResponseBody": { "token_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token", @@ -101,7 +100,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.6.2 (Windows-10-10.0.19041-SP0)" + "User-Agent": "azsdk-python-identity/1.9.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,13 +110,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:56:54 GMT", + "Date": "Mon, 28 Mar 2022 01:37:10 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12529.18 - SEASLR1 ProdSlices", - "x-ms-request-id": "706e43c6-274c-4a0a-ad0a-3192af430200" + "x-ms-ests-server": "2.1.12559.10 - NCUS ProdSlices" }, "ResponseBody": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/.well-known/openid-configuration", @@ -172,28 +170,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "8b7c39e6-b061-4774-8dae-8c90c8e5b9d2", + "client-request-id": "e684704d-e9ca-47f4-9add-1c0c9c0fd373", "Connection": "keep-alive", - "Content-Length": "291", + "Content-Length": "286", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.6.2 (Windows-10-10.0.19041-SP0)", + "User-Agent": "azsdk-python-identity/1.9.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", - "x-client-os": "win32", + "x-client-os": "linux", "x-client-sku": "MSAL.Python", "x-client-ver": "1.17.0", "x-ms-lib-capability": "retry-after, h429" }, - "RequestBody": "client_id=a2df54d5-ab03-4725-9b80-9a00b3b1967f\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=0vj7Q%7EIsFayrD0V_8oyOfygU-GE3ELOabq95a\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", + "RequestBody": "client_id=8c41a920-007a-4844-a189-2d0efe39f51e\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=o0XWF_siD-FhI.5AE83-u0GaQHW_GP7cjy\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "8b7c39e6-b061-4774-8dae-8c90c8e5b9d2", + "client-request-id": "e684704d-e9ca-47f4-9add-1c0c9c0fd373", "Content-Length": "93", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:56:54 GMT", + "Date": "Mon, 28 Mar 2022 01:37:10 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,8 +199,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.12559.4 - WUS2 ProdSlices", - "x-ms-request-id": "4bfef876-d48c-4067-a3bc-70d357321f00" + "x-ms-ests-server": "2.1.12570.11 - WUS2 ProdSlices" }, "ResponseBody": { "token_type": "Bearer", @@ -212,38 +209,35 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "27", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "5c51fa82-a015-11ec-8f2e-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus2euap" }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/D72CC05C-2C1F-461D-BD51-C611FA8496AE?api-version=2021-12-01", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6D493BED-BFD4-4A2A-A3CC-9FF1B5996568?api-version=2021-10-15-preview", "Cache-Control": "no-cache", "Content-Length": "313", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:03 GMT", + "Date": "Mon, 28 Mar 2022 01:37:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Retry-After": "10", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8b4f5784-e3ce-42ee-9cd5-d52d8868739a", + "x-ms-correlation-request-id": "5577a2c8-7da0-4168-b840-f6063f86a09e", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "1ca8925f-ab3f-445c-96d7-f1b9fdf72d2d", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015704Z:8b4f5784-e3ce-42ee-9cd5-d52d8868739a" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013714Z:5577a2c8-7da0-4168-b840-f6063f86a09e" }, "ResponseBody": { "properties": { @@ -259,15 +253,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/D72CC05C-2C1F-461D-BD51-C611FA8496AE?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6D493BED-BFD4-4A2A-A3CC-9FF1B5996568?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "5c51fa82-a015-11ec-8f2e-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -275,7 +267,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:13 GMT", + "Date": "Mon, 28 Mar 2022 01:37:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -283,27 +275,24 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "db4a050c-8c94-4ff6-a99b-76e677aff51a", + "x-ms-correlation-request-id": "5d5ae767-6842-4243-9aaf-73892332d1a2", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-request-id": "464b311d-fd9d-49b8-ade0-135206e2f478", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015714Z:db4a050c-8c94-4ff6-a99b-76e677aff51a" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013724Z:5d5ae767-6842-4243-9aaf-73892332d1a2" }, "ResponseBody": { - "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/D72CC05C-2C1F-461D-BD51-C611FA8496AE?api-version=2021-12-01", - "name": "d72cc05c-2c1f-461d-bd51-c611fa8496ae", + "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6D493BED-BFD4-4A2A-A3CC-9FF1B5996568?api-version=2021-10-15-preview", + "name": "6d493bed-bfd4-4a2a-a3cc-9ff1b5996568", "status": "Succeeded" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "5c51fa82-a015-11ec-8f2e-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -311,7 +300,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:14 GMT", + "Date": "Mon, 28 Mar 2022 01:37:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -319,20 +308,23 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4c204c64-88c9-473d-b427-67ee65858e33", + "x-ms-correlation-request-id": "c70c4229-0589-4065-89be-87f3222d43d1", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "729b023b-9d6a-470f-9254-5732e811772c", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015715Z:4c204c64-88c9-473d-b427-67ee65858e33" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013724Z:c70c4229-0589-4065-89be-87f3222d43d1" }, "ResponseBody": { "properties": { "provisioningState": "Succeeded", "endpoint": "https://domainc98a23ef.eastus2euap-1.eventgrid.azure.net/api/events", "inputSchema": "EventGridSchema", - "metricResourceId": "332fa8d2-8d80-42fb-99cb-5927331f637b", + "metricResourceId": "1a9d63c0-ee14-45e5-a262-dd8dfdabc4ee", "publicNetworkAccess": "Enabled" }, + "sku": { + "name": "Basic" + }, "systemData": null, + "dataResidencyBoundary": "WithinGeopair", "location": "eastus2euap", "tags": null, "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef", @@ -341,17 +333,15 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "46", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "68bf2b0c-a015-11ec-b342-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "tags": { @@ -361,31 +351,34 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6ABC2518-6503-4C56-AD0E-AE2912D0E04D?api-version=2021-12-01", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/127C13A8-AF93-4429-B8C4-A07C7FFBD171?api-version=2021-10-15-preview", "Cache-Control": "no-cache", - "Content-Length": "529", + "Content-Length": "592", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:17 GMT", + "Date": "Mon, 28 Mar 2022 01:37:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Retry-After": "10", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f7dc3478-e48f-45ca-bbb2-1519dc0f5430", + "x-ms-correlation-request-id": "f9fbb349-e005-495c-88b1-53c05c3afd8a", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-request-id": "6cefeb2c-5003-489f-b7ee-3175098c67fc", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015718Z:f7dc3478-e48f-45ca-bbb2-1519dc0f5430" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013725Z:f9fbb349-e005-495c-88b1-53c05c3afd8a" }, "ResponseBody": { "properties": { "provisioningState": "Updating", "endpoint": "https://domainc98a23ef.eastus2euap-1.eventgrid.azure.net/api/events", "inputSchema": "EventGridSchema", - "metricResourceId": "332fa8d2-8d80-42fb-99cb-5927331f637b", + "metricResourceId": "1a9d63c0-ee14-45e5-a262-dd8dfdabc4ee", "publicNetworkAccess": "Enabled" }, + "sku": { + "name": "Basic" + }, "systemData": null, + "dataResidencyBoundary": "WithinGeopair", "location": "eastus2euap", "tags": { "tag1": "value1", @@ -397,15 +390,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6ABC2518-6503-4C56-AD0E-AE2912D0E04D?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/127C13A8-AF93-4429-B8C4-A07C7FFBD171?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "68bf2b0c-a015-11ec-b342-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -413,7 +404,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:27 GMT", + "Date": "Mon, 28 Mar 2022 01:37:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -421,27 +412,24 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f641859f-455a-45d8-a333-88a61b9e2488", + "x-ms-correlation-request-id": "ef10015b-fe09-4f2f-80c7-376b5e373147", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "7d498b3b-e2b9-424b-b654-cf3651f42e68", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015728Z:f641859f-455a-45d8-a333-88a61b9e2488" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013735Z:ef10015b-fe09-4f2f-80c7-376b5e373147" }, "ResponseBody": { - "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/6ABC2518-6503-4C56-AD0E-AE2912D0E04D?api-version=2021-12-01", - "name": "6abc2518-6503-4c56-ad0e-ae2912d0e04d", + "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/127C13A8-AF93-4429-B8C4-A07C7FFBD171?api-version=2021-10-15-preview", + "name": "127c13a8-af93-4429-b8c4-a07c7ffbd171", "status": "Succeeded" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "68bf2b0c-a015-11ec-b342-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -449,7 +437,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:28 GMT", + "Date": "Mon, 28 Mar 2022 01:37:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -457,20 +445,23 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "141e7248-4b79-4ece-9df7-e5d35b78c3b7", + "x-ms-correlation-request-id": "820a47d2-27aa-4b96-acac-545e26028ad3", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-request-id": "87cd3a57-09f7-4a6f-91d7-3c8194ca49d6", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015728Z:141e7248-4b79-4ece-9df7-e5d35b78c3b7" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013735Z:820a47d2-27aa-4b96-acac-545e26028ad3" }, "ResponseBody": { "properties": { "provisioningState": "Succeeded", "endpoint": "https://domainc98a23ef.eastus2euap-1.eventgrid.azure.net/api/events", "inputSchema": "EventGridSchema", - "metricResourceId": "332fa8d2-8d80-42fb-99cb-5927331f637b", + "metricResourceId": "1a9d63c0-ee14-45e5-a262-dd8dfdabc4ee", "publicNetworkAccess": "Enabled" }, + "sku": { + "name": "Basic" + }, "systemData": null, + "dataResidencyBoundary": "WithinGeopair", "location": "eastus2euap", "tags": { "tag1": "value1", @@ -482,15 +473,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "710025b0-a015-11ec-aa9e-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -498,7 +487,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:28 GMT", + "Date": "Mon, 28 Mar 2022 01:37:35 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -506,20 +495,23 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8f097578-9467-43bf-8778-55e8a7394be5", + "x-ms-correlation-request-id": "61d87434-7e3e-4f70-b561-a1e6f223cb75", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-request-id": "133bfe0e-2058-4ba3-a5f5-5658d9cdded2", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015729Z:8f097578-9467-43bf-8778-55e8a7394be5" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013735Z:61d87434-7e3e-4f70-b561-a1e6f223cb75" }, "ResponseBody": { "properties": { "provisioningState": "Succeeded", "endpoint": "https://domainc98a23ef.eastus2euap-1.eventgrid.azure.net/api/events", "inputSchema": "EventGridSchema", - "metricResourceId": "332fa8d2-8d80-42fb-99cb-5927331f637b", + "metricResourceId": "1a9d63c0-ee14-45e5-a262-dd8dfdabc4ee", "publicNetworkAccess": "Enabled" }, + "sku": { + "name": "Basic" + }, "systemData": null, + "dataResidencyBoundary": "WithinGeopair", "location": "eastus2euap", "tags": { "tag1": "value1", @@ -531,48 +523,43 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domainc98a23ef?api-version=2021-10-15-preview", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "71394dc6-a015-11ec-961d-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/5CDEE279-75FE-48A9-BC2C-690FA92DF13A?api-version=2021-12-01", + "Azure-AsyncOperation": "https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/A52D6ACC-B47F-4045-A9B9-AB7C410BD60D?api-version=2021-10-15-preview", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 10 Mar 2022 01:57:29 GMT", + "Date": "Mon, 28 Mar 2022 01:37:36 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationResults/5CDEE279-75FE-48A9-BC2C-690FA92DF13A?api-version=2021-12-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationResults/A52D6ACC-B47F-4045-A9B9-AB7C410BD60D?api-version=2021-10-15-preview", "Pragma": "no-cache", "Retry-After": "10", "Server": "Microsoft-HTTPAPI/2.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1a6934cb-0bb2-4911-8e9d-bee54725f47b", + "x-ms-correlation-request-id": "7db8148b-9424-45bb-bfb5-2f66cb18c265", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-request-id": "1a6934cb-0bb2-4911-8e9d-bee54725f47b", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015730Z:1a6934cb-0bb2-4911-8e9d-bee54725f47b" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013736Z:7db8148b-9424-45bb-bfb5-2f66cb18c265" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/5CDEE279-75FE-48A9-BC2C-690FA92DF13A?api-version=2021-12-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/A52D6ACC-B47F-4045-A9B9-AB7C410BD60D?api-version=2021-10-15-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-eventgrid/10.1.0 Python/3.6.2 (Windows-10-10.0.19041-SP0)", - "x-ms-client-request-id": "71394dc6-a015-11ec-961d-c0b6f9946f2d" + "User-Agent": "azsdk-python-mgmt-eventgrid/10.2.0b1 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -580,7 +567,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 10 Mar 2022 01:57:39 GMT", + "Date": "Mon, 28 Mar 2022 01:37:46 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-HTTPAPI/2.0", @@ -588,14 +575,13 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c8c089ba-d333-45cb-8818-a5a70dca206c", + "x-ms-correlation-request-id": "959d663e-7872-40f4-8545-dbfe3f18983f", "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-request-id": "a201a663-6449-4187-b666-a6b9b17fadfe", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220310T015740Z:c8c089ba-d333-45cb-8818-a5a70dca206c" + "x-ms-routing-request-id": "NORTHCENTRALUS:20220328T013746Z:959d663e-7872-40f4-8545-dbfe3f18983f" }, "ResponseBody": { - "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/5CDEE279-75FE-48A9-BC2C-690FA92DF13A?api-version=2021-12-01", - "name": "5cdee279-75fe-48a9-bc2c-690fa92df13a", + "id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/A52D6ACC-B47F-4045-A9B9-AB7C410BD60D?api-version=2021-10-15-preview", + "name": "a52d6acc-b47f-4045-a9b9-ab7c410bd60d", "status": "Succeeded" } } diff --git a/shared_requirements.txt b/shared_requirements.txt index 2406d9be22b3..61ecb75b6ac0 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -310,6 +310,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-resource azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-cognitiveservices msrest>=0.6.21 #override azure-mgmt-cognitiveservices azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-eventgrid azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-frontdoor msrest>=0.6.21 #override azure-mgmt-frontdoor azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-signalr msrest>=0.6.21