diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md index ccbd4d092cc1..e40fb4c092ad 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md @@ -1,5 +1,45 @@ # Release History +## 3.0.0rc5 (2020-03-19) + +**Features** + +- Model Domain has a new parameter public_network_access +- Model Domain has a new parameter identity +- Model Domain has a new parameter private_endpoint_connections +- Model Domain has a new parameter sku +- Model DomainUpdateParameters has a new parameter public_network_access +- Model DomainUpdateParameters has a new parameter identity +- Model DomainUpdateParameters has a new parameter sku +- Model TopicUpdateParameters has a new parameter public_network_access +- Model TopicUpdateParameters has a new parameter identity +- Model TopicUpdateParameters has a new parameter sku +- Model EventSubscriptionUpdateParameters has a new parameter dead_letter_with_resource_identity +- Model EventSubscriptionUpdateParameters has a new parameter delivery_with_resource_identity +- Model Topic has a new parameter public_network_access +- Model Topic has a new parameter identity +- Model Topic has a new parameter private_endpoint_connections +- Model Topic has a new parameter sku +- Model EventSubscription has a new parameter dead_letter_with_resource_identity +- Model EventSubscription has a new parameter delivery_with_resource_identity +- Added operation group PrivateLinkResourcesOperations +- Added operation group SystemTopicsOperations +- Added operation group PrivateEndpointConnectionsOperations +- Added operation group PartnerTopicsOperations +- Added operation group PartnerNamespacesOperations +- Added operation group PartnerTopicEventSubscriptionsOperations +- Added operation group PartnerRegistrationsOperations +- Added operation group ExtensionTopicsOperations +- Added operation group SystemTopicEventSubscriptionsOperations +- Added operation group EventChannelsOperations + +**Breaking changes** + +- Model Domain no longer has parameter allow_traffic_from_all_ips +- Model DomainUpdateParameters no longer has parameter allow_traffic_from_all_ips +- Model TopicUpdateParameters no longer has parameter allow_traffic_from_all_ips +- Model Topic no longer has parameter allow_traffic_from_all_ips + ## 3.0.0rc4 (2020-01-17) **Features** diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/README.md b/sdk/eventgrid/azure-mgmt-eventgrid/README.md index 4a32536bce92..c0d223ed7a4c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/README.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure EventGrid Management Client Library. - -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). - This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. - -For a more complete set of Azure libraries, see the -[azure](https://pypi.python.org/pypi/azure) bundle package. -## Usage +# Usage -For code examples, see [EventGrid -Management](https://docs.microsoft.com/python/api/overview/azure/event-grid) +For code examples, see [EventGrid Management](https://docs.microsoft.com/python/api/overview/azure/event-grid) on docs.microsoft.com. -## Provide Feedback -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-eventgrid%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-eventgrid%2FREADME.png) 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 c0acd1541bf7..829072a97703 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 @@ -15,9 +15,19 @@ from ._configuration import EventGridManagementClientConfiguration from .operations import DomainsOperations from .operations import DomainTopicsOperations +from .operations import EventChannelsOperations from .operations import EventSubscriptionsOperations +from .operations import SystemTopicEventSubscriptionsOperations +from .operations import PartnerTopicEventSubscriptionsOperations from .operations import Operations +from .operations import PartnerNamespacesOperations +from .operations import PartnerRegistrationsOperations +from .operations import PartnerTopicsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import SystemTopicsOperations from .operations import TopicsOperations +from .operations import ExtensionTopicsOperations from .operations import TopicTypesOperations from . import models @@ -32,12 +42,32 @@ class EventGridManagementClient(SDKClient): :vartype domains: azure.mgmt.eventgrid.operations.DomainsOperations :ivar domain_topics: DomainTopics operations :vartype domain_topics: azure.mgmt.eventgrid.operations.DomainTopicsOperations + :ivar event_channels: EventChannels operations + :vartype event_channels: azure.mgmt.eventgrid.operations.EventChannelsOperations :ivar event_subscriptions: EventSubscriptions operations :vartype event_subscriptions: azure.mgmt.eventgrid.operations.EventSubscriptionsOperations + :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptions operations + :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations + :ivar partner_topic_event_subscriptions: PartnerTopicEventSubscriptions operations + :vartype partner_topic_event_subscriptions: azure.mgmt.eventgrid.operations.PartnerTopicEventSubscriptionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.operations.Operations + :ivar partner_namespaces: PartnerNamespaces operations + :vartype partner_namespaces: azure.mgmt.eventgrid.operations.PartnerNamespacesOperations + :ivar partner_registrations: PartnerRegistrations operations + :vartype partner_registrations: azure.mgmt.eventgrid.operations.PartnerRegistrationsOperations + :ivar partner_topics: PartnerTopics operations + :vartype partner_topics: azure.mgmt.eventgrid.operations.PartnerTopicsOperations + :ivar private_endpoint_connections: PrivateEndpointConnections operations + :vartype private_endpoint_connections: azure.mgmt.eventgrid.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResources operations + :vartype private_link_resources: azure.mgmt.eventgrid.operations.PrivateLinkResourcesOperations + :ivar system_topics: SystemTopics operations + :vartype system_topics: azure.mgmt.eventgrid.operations.SystemTopicsOperations :ivar topics: Topics operations :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations + :ivar extension_topics: ExtensionTopics operations + :vartype extension_topics: azure.mgmt.eventgrid.operations.ExtensionTopicsOperations :ivar topic_types: TopicTypes operations :vartype topic_types: azure.mgmt.eventgrid.operations.TopicTypesOperations @@ -66,11 +96,31 @@ def __init__( 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.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.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) 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 b3e80dc36b0b..538fd1e5bf7c 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 @@ -13,20 +13,29 @@ 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 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 DomainUpdateParameters + from ._models_py3 import EventChannel + from ._models_py3 import EventChannelDestination + from ._models_py3 import EventChannelSource 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 EventType + 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 JsonField @@ -40,10 +49,27 @@ from ._models_py3 import NumberNotInAdvancedFilter from ._models_py3 import Operation from ._models_py3 import OperationInfo + from ._models_py3 import PartnerNamespace + from ._models_py3 import PartnerNamespaceRegenerateKeyRequest + from ._models_py3 import PartnerNamespaceSharedAccessKeys + from ._models_py3 import PartnerNamespaceUpdateParameters + from ._models_py3 import PartnerRegistration + from ._models_py3 import PartnerRegistrationEventTypesListResult + from ._models_py3 import PartnerRegistrationUpdateParameters + from ._models_py3 import PartnerTopic + from ._models_py3 import PartnerTopicType + from ._models_py3 import PartnerTopicTypesListResult + from ._models_py3 import PartnerTopicUpdateParameters + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateLinkResource from ._models_py3 import Resource + from ._models_py3 import ResourceSku from ._models_py3 import RetryPolicy from ._models_py3 import ServiceBusQueueEventSubscriptionDestination from ._models_py3 import ServiceBusTopicEventSubscriptionDestination + from ._models_py3 import SkuDefinitionsForResourceType + from ._models_py3 import SkuDefinitionsForResourceTypeListResult from ._models_py3 import StorageBlobDeadLetterDestination from ._models_py3 import StorageQueueEventSubscriptionDestination from ._models_py3 import StringBeginsWithAdvancedFilter @@ -51,31 +77,43 @@ from ._models_py3 import StringEndsWithAdvancedFilter from ._models_py3 import StringInAdvancedFilter from ._models_py3 import StringNotInAdvancedFilter + from ._models_py3 import SystemTopic + from ._models_py3 import SystemTopicUpdateParameters from ._models_py3 import Topic from ._models_py3 import TopicRegenerateKeyRequest from ._models_py3 import TopicSharedAccessKeys from ._models_py3 import TopicTypeInfo from ._models_py3 import TopicUpdateParameters from ._models_py3 import TrackedResource + from ._models_py3 import UserIdentityProperties from ._models_py3 import WebHookEventSubscriptionDestination except (SyntaxError, ImportError): from ._models import AdvancedFilter from ._models import AzureFunctionEventSubscriptionDestination from ._models import BoolEqualsAdvancedFilter + from ._models import ConnectionState from ._models import DeadLetterDestination + from ._models import DeadLetterWithResourceIdentity + from ._models import DeliveryWithResourceIdentity from ._models import Domain from ._models import DomainRegenerateKeyRequest from ._models import DomainSharedAccessKeys from ._models import DomainTopic from ._models import DomainUpdateParameters + from ._models import EventChannel + from ._models import EventChannelDestination + from ._models import EventChannelSource from ._models import EventHubEventSubscriptionDestination from ._models import EventSubscription from ._models import EventSubscriptionDestination from ._models import EventSubscriptionFilter from ._models import EventSubscriptionFullUrl + from ._models import EventSubscriptionIdentity from ._models import EventSubscriptionUpdateParameters from ._models import EventType + from ._models import ExtensionTopic from ._models import HybridConnectionEventSubscriptionDestination + from ._models import IdentityInfo from ._models import InboundIpRule from ._models import InputSchemaMapping from ._models import JsonField @@ -89,10 +127,27 @@ from ._models import NumberNotInAdvancedFilter from ._models import Operation from ._models import OperationInfo + from ._models import PartnerNamespace + from ._models import PartnerNamespaceRegenerateKeyRequest + from ._models import PartnerNamespaceSharedAccessKeys + from ._models import PartnerNamespaceUpdateParameters + from ._models import PartnerRegistration + from ._models import PartnerRegistrationEventTypesListResult + from ._models import PartnerRegistrationUpdateParameters + from ._models import PartnerTopic + from ._models import PartnerTopicType + from ._models import PartnerTopicTypesListResult + from ._models import PartnerTopicUpdateParameters + from ._models import PrivateEndpoint + from ._models import PrivateEndpointConnection + from ._models import PrivateLinkResource from ._models import Resource + from ._models import ResourceSku from ._models import RetryPolicy from ._models import ServiceBusQueueEventSubscriptionDestination from ._models import ServiceBusTopicEventSubscriptionDestination + from ._models import SkuDefinitionsForResourceType + from ._models import SkuDefinitionsForResourceTypeListResult from ._models import StorageBlobDeadLetterDestination from ._models import StorageQueueEventSubscriptionDestination from ._models import StringBeginsWithAdvancedFilter @@ -100,27 +155,50 @@ from ._models import StringEndsWithAdvancedFilter from ._models import StringInAdvancedFilter from ._models import StringNotInAdvancedFilter + from ._models import SystemTopic + from ._models import SystemTopicUpdateParameters from ._models import Topic from ._models import TopicRegenerateKeyRequest from ._models import TopicSharedAccessKeys from ._models import TopicTypeInfo from ._models import TopicUpdateParameters from ._models import TrackedResource + from ._models import UserIdentityProperties from ._models import WebHookEventSubscriptionDestination from ._paged_models import DomainPaged from ._paged_models import DomainTopicPaged +from ._paged_models import EventChannelPaged from ._paged_models import EventSubscriptionPaged from ._paged_models import EventTypePaged from ._paged_models import OperationPaged +from ._paged_models import PartnerNamespacePaged +from ._paged_models import PartnerRegistrationPaged +from ._paged_models import PartnerTopicPaged +from ._paged_models import PrivateEndpointConnectionPaged +from ._paged_models import PrivateLinkResourcePaged +from ._paged_models import SystemTopicPaged from ._paged_models import TopicPaged from ._paged_models import TopicTypeInfoPaged from ._event_grid_management_client_enums import ( + PersistedConnectionStatus, + ResourceProvisioningState, DomainProvisioningState, InputSchema, + PublicNetworkAccess, IpActionType, + Sku, + IdentityType, DomainTopicProvisioningState, + EventChannelProvisioningState, EventSubscriptionProvisioningState, + EventSubscriptionIdentityType, EventDeliverySchema, + PartnerNamespaceProvisioningState, + PartnerRegistrationProvisioningState, + PartnerRegistrationVisibilityState, + PartnerTopicProvisioningState, + PartnerTopicActivationState, + PartnerTopicTypeAuthorizationState, TopicProvisioningState, ResourceRegionType, TopicTypeProvisioningState, @@ -130,20 +208,29 @@ 'AdvancedFilter', 'AzureFunctionEventSubscriptionDestination', 'BoolEqualsAdvancedFilter', + 'ConnectionState', 'DeadLetterDestination', + 'DeadLetterWithResourceIdentity', + 'DeliveryWithResourceIdentity', 'Domain', 'DomainRegenerateKeyRequest', 'DomainSharedAccessKeys', 'DomainTopic', 'DomainUpdateParameters', + 'EventChannel', + 'EventChannelDestination', + 'EventChannelSource', 'EventHubEventSubscriptionDestination', 'EventSubscription', 'EventSubscriptionDestination', 'EventSubscriptionFilter', 'EventSubscriptionFullUrl', + 'EventSubscriptionIdentity', 'EventSubscriptionUpdateParameters', 'EventType', + 'ExtensionTopic', 'HybridConnectionEventSubscriptionDestination', + 'IdentityInfo', 'InboundIpRule', 'InputSchemaMapping', 'JsonField', @@ -157,10 +244,27 @@ 'NumberNotInAdvancedFilter', 'Operation', 'OperationInfo', + 'PartnerNamespace', + 'PartnerNamespaceRegenerateKeyRequest', + 'PartnerNamespaceSharedAccessKeys', + 'PartnerNamespaceUpdateParameters', + 'PartnerRegistration', + 'PartnerRegistrationEventTypesListResult', + 'PartnerRegistrationUpdateParameters', + 'PartnerTopic', + 'PartnerTopicType', + 'PartnerTopicTypesListResult', + 'PartnerTopicUpdateParameters', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateLinkResource', 'Resource', + 'ResourceSku', 'RetryPolicy', 'ServiceBusQueueEventSubscriptionDestination', 'ServiceBusTopicEventSubscriptionDestination', + 'SkuDefinitionsForResourceType', + 'SkuDefinitionsForResourceTypeListResult', 'StorageBlobDeadLetterDestination', 'StorageQueueEventSubscriptionDestination', 'StringBeginsWithAdvancedFilter', @@ -168,26 +272,49 @@ 'StringEndsWithAdvancedFilter', 'StringInAdvancedFilter', 'StringNotInAdvancedFilter', + 'SystemTopic', + 'SystemTopicUpdateParameters', 'Topic', 'TopicRegenerateKeyRequest', 'TopicSharedAccessKeys', 'TopicTypeInfo', 'TopicUpdateParameters', 'TrackedResource', + 'UserIdentityProperties', 'WebHookEventSubscriptionDestination', 'DomainPaged', 'DomainTopicPaged', + 'EventChannelPaged', 'EventSubscriptionPaged', 'OperationPaged', + 'PartnerNamespacePaged', + 'PartnerRegistrationPaged', + 'PartnerTopicPaged', + 'PrivateEndpointConnectionPaged', + 'PrivateLinkResourcePaged', + 'SystemTopicPaged', 'TopicPaged', 'EventTypePaged', 'TopicTypeInfoPaged', + 'PersistedConnectionStatus', + 'ResourceProvisioningState', 'DomainProvisioningState', 'InputSchema', + 'PublicNetworkAccess', 'IpActionType', + 'Sku', + 'IdentityType', 'DomainTopicProvisioningState', + 'EventChannelProvisioningState', 'EventSubscriptionProvisioningState', + 'EventSubscriptionIdentityType', 'EventDeliverySchema', + 'PartnerNamespaceProvisioningState', + 'PartnerRegistrationProvisioningState', + 'PartnerRegistrationVisibilityState', + 'PartnerTopicProvisioningState', + 'PartnerTopicActivationState', + 'PartnerTopicTypeAuthorizationState', 'TopicProvisioningState', 'ResourceRegionType', 'TopicTypeProvisioningState', diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_event_grid_management_client_enums.py index 8772bd438926..f798c2958b9e 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 @@ -12,6 +12,24 @@ from enum import Enum +class PersistedConnectionStatus(str, Enum): + + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" + + +class ResourceProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + canceled = "Canceled" + failed = "Failed" + + class DomainProvisioningState(str, Enum): creating = "Creating" @@ -29,11 +47,31 @@ class InputSchema(str, Enum): cloud_event_schema_v1_0 = "CloudEventSchemaV1_0" +class PublicNetworkAccess(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class IpActionType(str, Enum): allow = "Allow" +class Sku(str, Enum): + + basic = "Basic" + premium = "Premium" + + +class IdentityType(str, Enum): + + none = "None" + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" + + class DomainTopicProvisioningState(str, Enum): creating = "Creating" @@ -44,6 +82,16 @@ class DomainTopicProvisioningState(str, Enum): failed = "Failed" +class EventChannelProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + canceled = "Canceled" + failed = "Failed" + + class EventSubscriptionProvisioningState(str, Enum): creating = "Creating" @@ -55,6 +103,12 @@ class EventSubscriptionProvisioningState(str, Enum): awaiting_manual_action = "AwaitingManualAction" +class EventSubscriptionIdentityType(str, Enum): + + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + + class EventDeliverySchema(str, Enum): event_grid_schema = "EventGridSchema" @@ -62,6 +116,57 @@ class EventDeliverySchema(str, Enum): cloud_event_schema_v1_0 = "CloudEventSchemaV1_0" +class PartnerNamespaceProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + canceled = "Canceled" + failed = "Failed" + + +class PartnerRegistrationProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + canceled = "Canceled" + failed = "Failed" + + +class PartnerRegistrationVisibilityState(str, Enum): + + hidden = "Hidden" + public_preview = "PublicPreview" + generally_available = "GenerallyAvailable" + + +class PartnerTopicProvisioningState(str, Enum): + + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + canceled = "Canceled" + failed = "Failed" + + +class PartnerTopicActivationState(str, Enum): + + never_activated = "NeverActivated" + activated = "Activated" + deactivated = "Deactivated" + + +class PartnerTopicTypeAuthorizationState(str, Enum): + + not_applicable = "NotApplicable" + not_authorized = "NotAuthorized" + authorized = "Authorized" + + class TopicProvisioningState(str, Enum): creating = "Creating" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py index a5cd04e53aaf..1de5cb112928 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models.py @@ -166,6 +166,32 @@ class CloudError(Model): } +class ConnectionState(Model): + """ConnectionState Information. + + :param status: Status of the connection. Possible values include: + 'Pending', 'Approved', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :param description: Description of the connection state. + :type description: str + :param actions_required: Actions required (if any). + :type 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): + super(ConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + class DeadLetterDestination(Model): """Information about the dead letter destination for an event subscription. To configure a deadletter destination, do not directly instantiate an object @@ -199,6 +225,56 @@ def __init__(self, **kwargs): self.endpoint_type = None +class DeadLetterWithResourceIdentity(Model): + """Information about the deadletter destination with resource identity. + + :param identity: The identity to use when dead-lettering events. + :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :param dead_letter_destination: Information about the destination where + events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_destination: + ~azure.mgmt.eventgrid.models.DeadLetterDestination + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, + 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, + } + + def __init__(self, **kwargs): + super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.dead_letter_destination = kwargs.get('dead_letter_destination', None) + + +class DeliveryWithResourceIdentity(Model): + """Information about the delivery for an event subscription with resource + identity. + + :param identity: The identity to use when delivering events. + :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :param destination: Information about the destination where events have to + be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. + :type destination: + ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, + 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, + } + + def __init__(self, **kwargs): + super(DeliveryWithResourceIdentity, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.destination = kwargs.get('destination', None) + + class Resource(Model): """Definition of a Resource. @@ -291,6 +367,9 @@ class Domain(TrackedResource): :type location: str :param tags: Tags of the resource. :type tags: dict[str, str] + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] :ivar provisioning_state: Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' @@ -309,13 +388,21 @@ class Domain(TrackedResource): ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the domain. :vartype metric_resource_id: str - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the domain. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -334,24 +421,30 @@ class Domain(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, - 'allow_traffic_from_all_ips': {'key': 'properties.allowTrafficFromAllIPs', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } def __init__(self, **kwargs): super(Domain, self).__init__(**kwargs) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) self.provisioning_state = None self.endpoint = None self.input_schema = kwargs.get('input_schema', "EventGridSchema") self.input_schema_mapping = kwargs.get('input_schema_mapping', None) self.metric_resource_id = None - self.allow_traffic_from_all_ips = kwargs.get('allow_traffic_from_all_ips', None) + self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) class DomainRegenerateKeyRequest(Model): @@ -436,28 +529,136 @@ def __init__(self, **kwargs): class DomainUpdateParameters(Model): """Properties of the Domain update. - :param tags: Tags of the domains resource + :param tags: Tags of the domains resource. :type tags: dict[str, str] - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :param sku: The Sku pricing tier for the domain. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'allow_traffic_from_all_ips': {'key': 'allowTrafficFromAllIPs', 'type': 'bool'}, - 'inbound_ip_rules': {'key': 'inboundIpRules', 'type': '[InboundIpRule]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } def __init__(self, **kwargs): super(DomainUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.allow_traffic_from_all_ips = kwargs.get('allow_traffic_from_all_ips', None) + self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) + self.identity = kwargs.get('identity', None) + self.sku = kwargs.get('sku', None) + + +class EventChannel(Resource): + """Event Channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param source: Source of the event channel. This represents a unique + resource in the partner's resource model. + :type source: ~azure.mgmt.eventgrid.models.EventChannelSource + :param destination: Represents the destination of an event channel. + :type destination: ~azure.mgmt.eventgrid.models.EventChannelDestination + :ivar provisioning_state: Provisioning state of the event channel. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.EventChannelProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'EventChannelSource'}, + 'destination': {'key': 'properties.destination', 'type': 'EventChannelDestination'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventChannel, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.destination = kwargs.get('destination', None) + self.provisioning_state = None + + +class EventChannelDestination(Model): + """Properties of the destination of an event channel. + + :param azure_subscription_id: Azure subscription ID of the customer + creating the event channel. The partner topic + associated with the event channel will be created under this Azure + subscription. + :type azure_subscription_id: str + :param resource_group: Azure Resource Group of the customer creating the + event channel. The partner topic + associated with the event channel will be created under this resource + group. + :type resource_group: str + :param partner_topic_name: Name of the partner topic associated with the + event channel. + :type partner_topic_name: str + """ + + _attribute_map = { + 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'partner_topic_name': {'key': 'partnerTopicName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventChannelDestination, self).__init__(**kwargs) + self.azure_subscription_id = kwargs.get('azure_subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + self.partner_topic_name = kwargs.get('partner_topic_name', None) + + +class EventChannelSource(Model): + """Properties of the source of an event channel. + + :param source: The identifier of the resource that's the source of the + events. + This represents a unique resource in the partner's resource model. + :type source: str + """ + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventChannelSource, self).__init__(**kwargs) + self.source = kwargs.get('source', None) class EventHubEventSubscriptionDestination(EventSubscriptionDestination): @@ -508,8 +709,17 @@ class EventSubscription(Resource): ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState :param destination: Information about the destination where events have to be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :param delivery_with_resource_identity: Information about the destination + where events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. @@ -524,10 +734,21 @@ class EventSubscription(Resource): :param retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event - subscription. + :param dead_letter_destination: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is + sent to the dead letter destination. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :param dead_letter_with_resource_identity: The dead letter destination of + the event subscription. Any event that cannot be delivered to its' + destination is sent to the dead letter destination. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ _validation = { @@ -545,12 +766,14 @@ class EventSubscription(Resource): 'topic': {'key': 'properties.topic', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'destination': {'key': 'properties.destination', 'type': 'EventSubscriptionDestination'}, + 'delivery_with_resource_identity': {'key': 'properties.deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'properties.filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'properties.labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'properties.expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'properties.eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'properties.retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'properties.deadLetterDestination', 'type': 'DeadLetterDestination'}, + 'dead_letter_with_resource_identity': {'key': 'properties.deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } def __init__(self, **kwargs): @@ -558,12 +781,14 @@ def __init__(self, **kwargs): self.topic = None self.provisioning_state = None self.destination = kwargs.get('destination', None) + self.delivery_with_resource_identity = kwargs.get('delivery_with_resource_identity', None) self.filter = kwargs.get('filter', None) self.labels = kwargs.get('labels', None) self.expiration_time_utc = kwargs.get('expiration_time_utc', None) self.event_delivery_schema = kwargs.get('event_delivery_schema', None) self.retry_policy = kwargs.get('retry_policy', None) self.dead_letter_destination = kwargs.get('dead_letter_destination', None) + self.dead_letter_with_resource_identity = kwargs.get('dead_letter_with_resource_identity', None) class EventSubscriptionFilter(Model): @@ -625,13 +850,47 @@ def __init__(self, **kwargs): self.endpoint_url = kwargs.get('endpoint_url', None) +class EventSubscriptionIdentity(Model): + """The identity information with the event subscription. + + :param type: The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of + user-assigned identities. The type 'None' will remove any identity. + Possible values include: 'SystemAssigned', 'UserAssigned' + :type type: str or + ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :param user_assigned_identity: The user identity associated with the + resource. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EventSubscriptionIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + + class EventSubscriptionUpdateParameters(Model): """Properties of the Event Subscription update. :param destination: Information about the destination where events have to be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :param delivery_with_resource_identity: Information about the destination + where events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (topic / domain) to + acquire the authentication tokens being used during delivery / + dead-lettering. + :type delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. @@ -647,31 +906,46 @@ class EventSubscriptionUpdateParameters(Model): :param retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event - subscription. + :param dead_letter_destination: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is + sent to the dead letter destination. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :param dead_letter_with_resource_identity: The dead letter destination of + the event subscription. Any event that cannot be delivered to its' + destination is sent to the dead letter destination. + Uses the managed identity setup on the parent resource (topic / domain) to + acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ _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): 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): @@ -720,6 +994,46 @@ def __init__(self, **kwargs): self.is_in_default_set = kwargs.get('is_in_default_set', None) +class ExtensionTopic(Resource): + """Event grid Extension Topic. This is used for getting Event Grid related + metrics for Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param description: Description of the extension topic. + :type description: str + :param system_topic: System topic resource id which is mapped to the + source. + :type system_topic: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'system_topic': {'key': 'properties.systemTopic', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExtensionTopic, self).__init__(**kwargs) + 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. @@ -748,6 +1062,43 @@ def __init__(self, **kwargs): self.endpoint_type = 'HybridConnection' +class IdentityInfo(Model): + """The identity information for the resource. + + :param type: The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of + user-assigned identities. The type 'None' will remove any identity. + Possible values include: 'None', 'SystemAssigned', 'UserAssigned', + 'SystemAssigned, UserAssigned' + :type type: str or ~azure.mgmt.eventgrid.models.IdentityType + :param principal_id: The principal ID of resource identity. + :type principal_id: str + :param tenant_id: The tenant ID of resource. + :type tenant_id: str + :param user_assigned_identities: The list of user identities associated + with the resource. The user identity dictionary key references will be ARM + resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + This property is currently not used and reserved for future usage. + :type user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__(self, **kwargs): + super(IdentityInfo, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.principal_id = kwargs.get('principal_id', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + class InboundIpRule(Model): """InboundIpRule. @@ -1141,104 +1492,698 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class RetryPolicy(Model): - """Information about the retry policy for an event subscription. +class PartnerNamespace(TrackedResource): + """EventGrid Partner Namespace. - :param max_delivery_attempts: Maximum number of delivery retry attempts - for events. - :type max_delivery_attempts: int - :param event_time_to_live_in_minutes: Time To Live (in minutes) for - events. - :type event_time_to_live_in_minutes: int + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the partner namespace. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerNamespaceProvisioningState + :param partner_registration_fully_qualified_id: The fully qualified ARM Id + of the partner registration that should be associated with this partner + namespace. This takes the following format: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. + :type partner_registration_fully_qualified_id: str + :ivar endpoint: Endpoint for the partner namespace. + :vartype endpoint: str """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + _attribute_map = { - 'max_delivery_attempts': {'key': 'maxDeliveryAttempts', 'type': 'int'}, - 'event_time_to_live_in_minutes': {'key': 'eventTimeToLiveInMinutes', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_registration_fully_qualified_id': {'key': 'properties.partnerRegistrationFullyQualifiedId', 'type': 'str'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, } def __init__(self, **kwargs): - super(RetryPolicy, self).__init__(**kwargs) - self.max_delivery_attempts = kwargs.get('max_delivery_attempts', None) - self.event_time_to_live_in_minutes = kwargs.get('event_time_to_live_in_minutes', None) + super(PartnerNamespace, self).__init__(**kwargs) + self.provisioning_state = None + self.partner_registration_fully_qualified_id = kwargs.get('partner_registration_fully_qualified_id', None) + self.endpoint = None -class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus destination for an event subscription. +class PartnerNamespaceRegenerateKeyRequest(Model): + """PartnerNamespace regenerate shared access key request. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus destination of an event subscription. - :type resource_id: str + :param key_name: Required. Key name to regenerate (key1 or key2). + :type key_name: str """ _validation = { - 'endpoint_type': {'required': True}, + 'key_name': {'required': True}, } _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, } def __init__(self, **kwargs): - super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'ServiceBusQueue' - + super(PartnerNamespaceRegenerateKeyRequest, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', 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. +class PartnerNamespaceSharedAccessKeys(Model): + """Shared access keys of the partner namespace. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus Topic destination of an event subscription. - :type resource_id: str + :param key1: Shared access key1 for the partner namespace. + :type key1: str + :param key2: Shared access key2 for the partner namespace. + :type key2: str """ - _validation = { - 'endpoint_type': {'required': True}, - } - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, } def __init__(self, **kwargs): - super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.endpoint_type = 'ServiceBusTopic' - + super(PartnerNamespaceSharedAccessKeys, self).__init__(**kwargs) + self.key1 = kwargs.get('key1', None) + self.key2 = kwargs.get('key2', None) -class StorageBlobDeadLetterDestination(DeadLetterDestination): - """Information about the storage blob based dead letter destination. - All required parameters must be populated in order to send to Azure. +class PartnerNamespaceUpdateParameters(Model): + """Properties of the PartnerNamespace update. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that is - the destination of the deadletter events - :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is - the destination of the deadletter events - :type blob_container_name: str + :param tags: Tags of the partner namespace. + :type tags: dict[str, str] """ - _validation = { - 'endpoint_type': {'required': True}, + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, } - _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + def __init__(self, **kwargs): + super(PartnerNamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class PartnerRegistration(TrackedResource): + """Information about a partner registration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the partner registration. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationProvisioningState + :param partner_name: Official name of the partner name. For example: + "Contoso". + :type partner_name: str + :param partner_resource_type_name: Name of the partner resource type. + :type partner_resource_type_name: str + :param partner_resource_type_display_name: Display name of the partner + resource type. + :type partner_resource_type_display_name: str + :param partner_resource_type_description: Description of the partner + resource type. + :type partner_resource_type_description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param logo_uri: URI of the logo. + :type logo_uri: str + :param visibility_state: Visibility state of the partner registration. + Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' + :type visibility_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState + :param authorized_azure_subscription_ids: List of Azure subscription Ids + that are authorized to create a partner namespace + associated with this partner registration. This is an optional property. + Creating + partner namespaces is always permitted under the same Azure subscription + as the one used + for creating the partner registration. + :type authorized_azure_subscription_ids: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, + 'partner_resource_type_name': {'key': 'properties.partnerResourceTypeName', 'type': 'str'}, + 'partner_resource_type_display_name': {'key': 'properties.partnerResourceTypeDisplayName', 'type': 'str'}, + 'partner_resource_type_description': {'key': 'properties.partnerResourceTypeDescription', 'type': 'str'}, + 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, + 'logo_uri': {'key': 'properties.logoUri', 'type': 'str'}, + 'visibility_state': {'key': 'properties.visibilityState', 'type': 'str'}, + 'authorized_azure_subscription_ids': {'key': 'properties.authorizedAzureSubscriptionIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(PartnerRegistration, self).__init__(**kwargs) + self.provisioning_state = None + self.partner_name = kwargs.get('partner_name', None) + self.partner_resource_type_name = kwargs.get('partner_resource_type_name', None) + self.partner_resource_type_display_name = kwargs.get('partner_resource_type_display_name', None) + self.partner_resource_type_description = kwargs.get('partner_resource_type_description', None) + self.setup_uri = kwargs.get('setup_uri', None) + self.logo_uri = kwargs.get('logo_uri', None) + self.visibility_state = kwargs.get('visibility_state', None) + self.authorized_azure_subscription_ids = kwargs.get('authorized_azure_subscription_ids', None) + + +class PartnerRegistrationEventTypesListResult(Model): + """Result of the List Partner Registration Event Types operation. + + :param value: A collection of partner registration event types. + :type value: list[~azure.mgmt.eventgrid.models.EventType] + :param next_link: A link for the next page of partner registration event + types. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartnerRegistrationEventTypesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PartnerRegistrationUpdateParameters(Model): + """Properties of the Partner Registration update. + + :param partner_topic_type_name: Name of the partner topic type. + :type partner_topic_type_name: str + :param partner_topic_type_display_name: Display name of the partner topic + type. + :type partner_topic_type_display_name: str + :param partner_topic_type_description: Description of the partner topic + type. + :type partner_topic_type_description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param logo_uri: URI of the partner logo. + :type logo_uri: str + :param authorized_azure_subscription_ids: List of IDs of Azure AD + applications that are authorized to create a partner namespace + associated with this partner registration. This is an optional property. + Creating + partner namespaces is always permitted under the same Azure subscription + as the one used + for creating the partner registration. + :type authorized_azure_subscription_ids: list[str] + """ + + _attribute_map = { + 'partner_topic_type_name': {'key': 'partnerTopicTypeName', 'type': 'str'}, + 'partner_topic_type_display_name': {'key': 'partnerTopicTypeDisplayName', 'type': 'str'}, + 'partner_topic_type_description': {'key': 'partnerTopicTypeDescription', 'type': 'str'}, + 'setup_uri': {'key': 'setupUri', 'type': 'str'}, + 'logo_uri': {'key': 'logoUri', 'type': 'str'}, + 'authorized_azure_subscription_ids': {'key': 'authorizedAzureSubscriptionIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(PartnerRegistrationUpdateParameters, self).__init__(**kwargs) + self.partner_topic_type_name = kwargs.get('partner_topic_type_name', None) + self.partner_topic_type_display_name = kwargs.get('partner_topic_type_display_name', None) + self.partner_topic_type_description = kwargs.get('partner_topic_type_description', None) + self.setup_uri = kwargs.get('setup_uri', None) + self.logo_uri = kwargs.get('logo_uri', None) + self.authorized_azure_subscription_ids = kwargs.get('authorized_azure_subscription_ids', None) + + +class PartnerTopic(TrackedResource): + """EventGrid Partner Topic. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :param source: Source associated with this partner topic. This represents + a unique partner resource. + :type source: str + :ivar provisioning_state: Provisioning state of the partner topic. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicProvisioningState + :param activation_state: Activation state of the partner topic. Possible + values include: 'NeverActivated', 'Activated', 'Deactivated' + :type activation_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicActivationState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'activation_state': {'key': 'properties.activationState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartnerTopic, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.provisioning_state = None + self.activation_state = kwargs.get('activation_state', None) + + +class PartnerTopicType(Resource): + """Properties of a partner topic type. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param partner_name: Official name of the partner. + :type partner_name: str + :param topic_type_name: Name of the partner topic type. This name should + be unique among all partner topic types names. + :type topic_type_name: str + :param display_name: Display Name for the partner topic type. + :type display_name: str + :param description: Description of the partner topic type. + :type description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param authorization_state: Status of whether the customer has authorized + a partner to create partner topics + in the customer's subscription. Possible values include: 'NotApplicable', + 'NotAuthorized', 'Authorized' + :type authorization_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicTypeAuthorizationState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, + 'topic_type_name': {'key': 'properties.topicTypeName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, + 'authorization_state': {'key': 'properties.authorizationState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PartnerTopicType, self).__init__(**kwargs) + self.partner_name = kwargs.get('partner_name', None) + self.topic_type_name = kwargs.get('topic_type_name', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.setup_uri = kwargs.get('setup_uri', None) + self.authorization_state = kwargs.get('authorization_state', None) + + +class PartnerTopicTypesListResult(Model): + """Result of the List Partner Topic Types operation. + + :param value: A collection of partner topic types. + :type value: list[~azure.mgmt.eventgrid.models.PartnerTopicType] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PartnerTopicType]'}, + } + + def __init__(self, **kwargs): + super(PartnerTopicTypesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PartnerTopicUpdateParameters(Model): + """Properties of the Partner Topic update. + + :param tags: Tags of the partner topic. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(PartnerTopicUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class PrivateEndpoint(Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointConnection(Resource): + """PrivateEndpointConnection resource information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param private_endpoint: The Private Endpoint resource for this + Connection. + :type private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :param group_ids: GroupIds from the private link service resource. + :type group_ids: list[str] + :param private_link_service_connection_state: Details about the state of + the connection. + :type private_link_service_connection_state: + ~azure.mgmt.eventgrid.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint + Connection. Possible values include: 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Canceled', 'Failed' + :type provisioning_state: str or + ~azure.mgmt.eventgrid.models.ResourceProvisioningState + """ + + _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): + 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 PrivateLinkResource(Model): + """Information of the private link resource. + + :param group_id: + :type group_id: str + :param display_name: + :type display_name: str + :param required_members: + :type required_members: list[str] + :param required_zone_names: + :type required_zone_names: list[str] + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource + :type name: str + :param type: Type of the resource + :type type: str + """ + + _attribute_map = { + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.display_name = kwargs.get('display_name', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class ResourceSku(Model): + """Describes an EventGrid Resource Sku. + + :param name: the Sku name of the resource. + the possible values: Basic; Premium. Possible values include: 'Basic', + 'Premium' + :type name: str or ~azure.mgmt.eventgrid.models.Sku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class RetryPolicy(Model): + """Information about the retry policy for an event subscription. + + :param max_delivery_attempts: Maximum number of delivery retry attempts + for events. + :type max_delivery_attempts: int + :param event_time_to_live_in_minutes: Time To Live (in minutes) for + events. + :type 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): + super(RetryPolicy, self).__init__(**kwargs) + self.max_delivery_attempts = kwargs.get('max_delivery_attempts', None) + self.event_time_to_live_in_minutes = kwargs.get('event_time_to_live_in_minutes', None) + + +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. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource Id that represents the endpoint of + the Service Bus destination of an event subscription. + :type resource_id: str + """ + + _validation = { + 'endpoint_type': {'required': True}, + } + + _attribute_map = { + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.endpoint_type = 'ServiceBusQueue' + + +class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): + """Information about the service bus topic destination for an event + subscription. + + All required parameters must be populated in order to send to Azure. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource Id that represents the endpoint of + the Service Bus Topic destination of an event subscription. + :type resource_id: str + """ + + _validation = { + 'endpoint_type': {'required': True}, + } + + _attribute_map = { + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.endpoint_type = 'ServiceBusTopic' + + +class SkuDefinitionsForResourceType(Model): + """Describes an EventGrid Resource Sku Definition. + + :param resource_type: The Resource Type applicable for the Sku. + :type resource_type: str + :param skus: The Sku pricing tiers for the resource type. + :type skus: list[~azure.mgmt.eventgrid.models.ResourceSku] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[ResourceSku]'}, + } + + def __init__(self, **kwargs): + super(SkuDefinitionsForResourceType, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.skus = kwargs.get('skus', None) + + +class SkuDefinitionsForResourceTypeListResult(Model): + """List collection of Sku Definitions for each Resource Type. + + :param value: A collection of Sku Definitions for each Resource Type. + :type value: + list[~azure.mgmt.eventgrid.models.SkuDefinitionsForResourceType] + :param next_link: A link for the next page of Sku Definitions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDefinitionsForResourceType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SkuDefinitionsForResourceTypeListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class StorageBlobDeadLetterDestination(DeadLetterDestination): + """Information about the storage blob based dead letter destination. + + All required parameters must be populated in order to send to Azure. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource ID of the storage account that is + the destination of the deadletter events + :type resource_id: str + :param blob_container_name: The name of the Storage blob container that is + the destination of the deadletter events + :type 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'}, } @@ -1432,6 +2377,82 @@ def __init__(self, **kwargs): self.operator_type = 'StringNotIn' +class SystemTopic(TrackedResource): + """EventGrid System Topic. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the system topic. Possible + values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :param source: Source for the system topic. + :type source: str + :param topic_type: TopicType for the system topic. + :type topic_type: str + :ivar metric_resource_id: Metric resource id for the system topic. + :vartype metric_resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'metric_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'topic_type': {'key': 'properties.topicType', 'type': 'str'}, + 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SystemTopic, self).__init__(**kwargs) + self.provisioning_state = None + self.source = kwargs.get('source', None) + self.topic_type = kwargs.get('topic_type', None) + self.metric_resource_id = None + + +class SystemTopicUpdateParameters(Model): + """Properties of the System Topic update. + + :param tags: Tags of the system topic. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(SystemTopicUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + class Topic(TrackedResource): """EventGrid Topic. @@ -1450,6 +2471,9 @@ class Topic(TrackedResource): :type location: str :param tags: Tags of the resource. :type tags: dict[str, str] + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] :ivar provisioning_state: Provisioning state of the topic. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' @@ -1470,13 +2494,21 @@ class Topic(TrackedResource): ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - to be applied when events are received on this topic. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the topic. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -1495,24 +2527,30 @@ class Topic(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, - 'allow_traffic_from_all_ips': {'key': 'properties.allowTrafficFromAllIPs', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } def __init__(self, **kwargs): super(Topic, self).__init__(**kwargs) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) self.provisioning_state = None self.endpoint = None self.input_schema = kwargs.get('input_schema', "EventGridSchema") self.input_schema_mapping = kwargs.get('input_schema_mapping', None) self.metric_resource_id = None - self.allow_traffic_from_all_ips = kwargs.get('allow_traffic_from_all_ips', None) + self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) class TopicRegenerateKeyRequest(Model): @@ -1626,26 +2664,58 @@ class TopicUpdateParameters(Model): :param tags: Tags of the resource. :type tags: dict[str, str] - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param identity: Resource identity information. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the topic. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'allow_traffic_from_all_ips': {'key': 'allowTrafficFromAllIPs', 'type': 'bool'}, - 'inbound_ip_rules': {'key': 'inboundIpRules', 'type': '[InboundIpRule]'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } def __init__(self, **kwargs): super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.allow_traffic_from_all_ips = kwargs.get('allow_traffic_from_all_ips', None) + self.identity = kwargs.get('identity', None) + self.public_network_access = kwargs.get('public_network_access', None) self.inbound_ip_rules = kwargs.get('inbound_ip_rules', None) + self.sku = kwargs.get('sku', None) + + +class UserIdentityProperties(Model): + """The information about the user identity. + + :param principal_id: The principal id of user assigned identity. + :type principal_id: str + :param client_id: The client id of user assigned identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.client_id = kwargs.get('client_id', None) class WebHookEventSubscriptionDestination(EventSubscriptionDestination): 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 ffcf536a1600..7e9db8370110 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 @@ -166,6 +166,32 @@ class CloudError(Model): } +class ConnectionState(Model): + """ConnectionState Information. + + :param status: Status of the connection. Possible values include: + 'Pending', 'Approved', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :param description: Description of the connection state. + :type description: str + :param actions_required: Actions required (if any). + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__(self, *, status=None, description: str=None, actions_required: str=None, **kwargs) -> None: + super(ConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + class DeadLetterDestination(Model): """Information about the dead letter destination for an event subscription. To configure a deadletter destination, do not directly instantiate an object @@ -199,6 +225,56 @@ def __init__(self, **kwargs) -> None: self.endpoint_type = None +class DeadLetterWithResourceIdentity(Model): + """Information about the deadletter destination with resource identity. + + :param identity: The identity to use when dead-lettering events. + :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :param dead_letter_destination: Information about the destination where + events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_destination: + ~azure.mgmt.eventgrid.models.DeadLetterDestination + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, + 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, + } + + def __init__(self, *, identity=None, dead_letter_destination=None, **kwargs) -> None: + super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) + self.identity = identity + self.dead_letter_destination = dead_letter_destination + + +class DeliveryWithResourceIdentity(Model): + """Information about the delivery for an event subscription with resource + identity. + + :param identity: The identity to use when delivering events. + :type identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :param destination: Information about the destination where events have to + be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. + :type destination: + ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + """ + + _attribute_map = { + 'identity': {'key': 'identity', 'type': 'EventSubscriptionIdentity'}, + 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, + } + + def __init__(self, *, identity=None, destination=None, **kwargs) -> None: + super(DeliveryWithResourceIdentity, self).__init__(**kwargs) + self.identity = identity + self.destination = destination + + class Resource(Model): """Definition of a Resource. @@ -291,6 +367,9 @@ class Domain(TrackedResource): :type location: str :param tags: Tags of the resource. :type tags: dict[str, str] + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] :ivar provisioning_state: Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' @@ -309,13 +388,21 @@ class Domain(TrackedResource): ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the domain. :vartype metric_resource_id: str - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the domain. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -334,24 +421,30 @@ class Domain(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, - 'allow_traffic_from_all_ips': {'key': 'properties.allowTrafficFromAllIPs', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, *, location: str, tags=None, input_schema="EventGridSchema", input_schema_mapping=None, allow_traffic_from_all_ips: bool=None, inbound_ip_rules=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, private_endpoint_connections=None, input_schema="EventGridSchema", input_schema_mapping=None, public_network_access=None, inbound_ip_rules=None, sku=None, identity=None, **kwargs) -> None: super(Domain, self).__init__(location=location, tags=tags, **kwargs) + self.private_endpoint_connections = private_endpoint_connections self.provisioning_state = None self.endpoint = None self.input_schema = input_schema self.input_schema_mapping = input_schema_mapping self.metric_resource_id = None - self.allow_traffic_from_all_ips = allow_traffic_from_all_ips + self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules + self.sku = sku + self.identity = identity class DomainRegenerateKeyRequest(Model): @@ -436,28 +529,136 @@ def __init__(self, *, provisioning_state=None, **kwargs) -> None: class DomainUpdateParameters(Model): """Properties of the Domain update. - :param tags: Tags of the domains resource + :param tags: Tags of the domains resource. :type tags: dict[str, str] - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :param sku: The Sku pricing tier for the domain. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'allow_traffic_from_all_ips': {'key': 'allowTrafficFromAllIPs', 'type': 'bool'}, - 'inbound_ip_rules': {'key': 'inboundIpRules', 'type': '[InboundIpRule]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } - def __init__(self, *, tags=None, allow_traffic_from_all_ips: bool=None, inbound_ip_rules=None, **kwargs) -> None: + def __init__(self, *, tags=None, public_network_access=None, inbound_ip_rules=None, identity=None, sku=None, **kwargs) -> None: super(DomainUpdateParameters, self).__init__(**kwargs) self.tags = tags - self.allow_traffic_from_all_ips = allow_traffic_from_all_ips + self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules + self.identity = identity + self.sku = sku + + +class EventChannel(Resource): + """Event Channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param source: Source of the event channel. This represents a unique + resource in the partner's resource model. + :type source: ~azure.mgmt.eventgrid.models.EventChannelSource + :param destination: Represents the destination of an event channel. + :type destination: ~azure.mgmt.eventgrid.models.EventChannelDestination + :ivar provisioning_state: Provisioning state of the event channel. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.EventChannelProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'EventChannelSource'}, + 'destination': {'key': 'properties.destination', 'type': 'EventChannelDestination'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, source=None, destination=None, **kwargs) -> None: + super(EventChannel, self).__init__(**kwargs) + self.source = source + self.destination = destination + self.provisioning_state = None + + +class EventChannelDestination(Model): + """Properties of the destination of an event channel. + + :param azure_subscription_id: Azure subscription ID of the customer + creating the event channel. The partner topic + associated with the event channel will be created under this Azure + subscription. + :type azure_subscription_id: str + :param resource_group: Azure Resource Group of the customer creating the + event channel. The partner topic + associated with the event channel will be created under this resource + group. + :type resource_group: str + :param partner_topic_name: Name of the partner topic associated with the + event channel. + :type partner_topic_name: str + """ + + _attribute_map = { + 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'partner_topic_name': {'key': 'partnerTopicName', 'type': 'str'}, + } + + def __init__(self, *, azure_subscription_id: str=None, resource_group: str=None, partner_topic_name: str=None, **kwargs) -> None: + super(EventChannelDestination, self).__init__(**kwargs) + self.azure_subscription_id = azure_subscription_id + self.resource_group = resource_group + self.partner_topic_name = partner_topic_name + + +class EventChannelSource(Model): + """Properties of the source of an event channel. + + :param source: The identifier of the resource that's the source of the + events. + This represents a unique resource in the partner's resource model. + :type source: str + """ + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__(self, *, source: str=None, **kwargs) -> None: + super(EventChannelSource, self).__init__(**kwargs) + self.source = source class EventHubEventSubscriptionDestination(EventSubscriptionDestination): @@ -508,8 +709,17 @@ class EventSubscription(Resource): ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState :param destination: Information about the destination where events have to be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :param delivery_with_resource_identity: Information about the destination + where events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. @@ -524,10 +734,21 @@ class EventSubscription(Resource): :param retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event - subscription. + :param dead_letter_destination: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is + sent to the dead letter destination. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :param dead_letter_with_resource_identity: The dead letter destination of + the event subscription. Any event that cannot be delivered to its' + destination is sent to the dead letter destination. + Uses the managed identity setup on the parent resource (namely, topic or + domain) to acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ _validation = { @@ -545,25 +766,29 @@ class EventSubscription(Resource): 'topic': {'key': 'properties.topic', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'destination': {'key': 'properties.destination', 'type': 'EventSubscriptionDestination'}, + 'delivery_with_resource_identity': {'key': 'properties.deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'properties.filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'properties.labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'properties.expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'properties.eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'properties.retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'properties.deadLetterDestination', 'type': 'DeadLetterDestination'}, + 'dead_letter_with_resource_identity': {'key': 'properties.deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, *, destination=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, **kwargs) -> None: + def __init__(self, *, destination=None, delivery_with_resource_identity=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, dead_letter_with_resource_identity=None, **kwargs) -> None: super(EventSubscription, self).__init__(**kwargs) self.topic = None self.provisioning_state = None self.destination = destination + self.delivery_with_resource_identity = delivery_with_resource_identity self.filter = filter self.labels = labels self.expiration_time_utc = expiration_time_utc self.event_delivery_schema = event_delivery_schema self.retry_policy = retry_policy self.dead_letter_destination = dead_letter_destination + self.dead_letter_with_resource_identity = dead_letter_with_resource_identity class EventSubscriptionFilter(Model): @@ -625,13 +850,47 @@ def __init__(self, *, endpoint_url: str=None, **kwargs) -> None: self.endpoint_url = endpoint_url +class EventSubscriptionIdentity(Model): + """The identity information with the event subscription. + + :param type: The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of + user-assigned identities. The type 'None' will remove any identity. + Possible values include: 'SystemAssigned', 'UserAssigned' + :type type: str or + ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :param user_assigned_identity: The user identity associated with the + resource. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__(self, *, type=None, user_assigned_identity: str=None, **kwargs) -> None: + super(EventSubscriptionIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identity = user_assigned_identity + + class EventSubscriptionUpdateParameters(Model): """Properties of the Event Subscription update. :param destination: Information about the destination where events have to be delivered for the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :param delivery_with_resource_identity: Information about the destination + where events have to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (topic / domain) to + acquire the authentication tokens being used during delivery / + dead-lettering. + :type delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity :param filter: Information about the filter for the event subscription. :type filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter :param labels: List of user defined labels. @@ -647,31 +906,46 @@ class EventSubscriptionUpdateParameters(Model): :param retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event - subscription. + :param dead_letter_destination: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is + sent to the dead letter destination. + Uses Azure Event Grid's identity to acquire the authentication tokens + being used during delivery / dead-lettering. :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :param dead_letter_with_resource_identity: The dead letter destination of + the event subscription. Any event that cannot be delivered to its' + destination is sent to the dead letter destination. + Uses the managed identity setup on the parent resource (topic / domain) to + acquire the authentication tokens being used during delivery / + dead-lettering. + :type dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ _attribute_map = { 'destination': {'key': 'destination', 'type': 'EventSubscriptionDestination'}, + 'delivery_with_resource_identity': {'key': 'deliveryWithResourceIdentity', 'type': 'DeliveryWithResourceIdentity'}, 'filter': {'key': 'filter', 'type': 'EventSubscriptionFilter'}, 'labels': {'key': 'labels', 'type': '[str]'}, 'expiration_time_utc': {'key': 'expirationTimeUtc', 'type': 'iso-8601'}, 'event_delivery_schema': {'key': 'eventDeliverySchema', 'type': 'str'}, 'retry_policy': {'key': 'retryPolicy', 'type': 'RetryPolicy'}, 'dead_letter_destination': {'key': 'deadLetterDestination', 'type': 'DeadLetterDestination'}, + 'dead_letter_with_resource_identity': {'key': 'deadLetterWithResourceIdentity', 'type': 'DeadLetterWithResourceIdentity'}, } - def __init__(self, *, destination=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, **kwargs) -> None: + def __init__(self, *, destination=None, delivery_with_resource_identity=None, filter=None, labels=None, expiration_time_utc=None, event_delivery_schema=None, retry_policy=None, dead_letter_destination=None, dead_letter_with_resource_identity=None, **kwargs) -> None: super(EventSubscriptionUpdateParameters, self).__init__(**kwargs) self.destination = destination + self.delivery_with_resource_identity = delivery_with_resource_identity self.filter = filter self.labels = labels self.expiration_time_utc = expiration_time_utc self.event_delivery_schema = event_delivery_schema self.retry_policy = retry_policy self.dead_letter_destination = dead_letter_destination + self.dead_letter_with_resource_identity = dead_letter_with_resource_identity class EventType(Resource): @@ -720,6 +994,46 @@ def __init__(self, *, display_name: str=None, description: str=None, schema_url: self.is_in_default_set = is_in_default_set +class ExtensionTopic(Resource): + """Event grid Extension Topic. This is used for getting Event Grid related + metrics for Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param description: Description of the extension topic. + :type description: str + :param system_topic: System topic resource id which is mapped to the + source. + :type system_topic: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'system_topic': {'key': 'properties.systemTopic', 'type': 'str'}, + } + + def __init__(self, *, description: str=None, system_topic: str=None, **kwargs) -> None: + super(ExtensionTopic, self).__init__(**kwargs) + self.description = description + self.system_topic = system_topic + + class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination): """Information about the HybridConnection destination for an event subscription. @@ -748,6 +1062,43 @@ def __init__(self, *, resource_id: str=None, **kwargs) -> None: self.endpoint_type = 'HybridConnection' +class IdentityInfo(Model): + """The identity information for the resource. + + :param type: The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of + user-assigned identities. The type 'None' will remove any identity. + Possible values include: 'None', 'SystemAssigned', 'UserAssigned', + 'SystemAssigned, UserAssigned' + :type type: str or ~azure.mgmt.eventgrid.models.IdentityType + :param principal_id: The principal ID of resource identity. + :type principal_id: str + :param tenant_id: The tenant ID of resource. + :type tenant_id: str + :param user_assigned_identities: The list of user identities associated + with the resource. The user identity dictionary key references will be ARM + resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + This property is currently not used and reserved for future usage. + :type user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentityProperties}'}, + } + + def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, user_assigned_identities=None, **kwargs) -> None: + super(IdentityInfo, self).__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.user_assigned_identities = user_assigned_identities + + class InboundIpRule(Model): """InboundIpRule. @@ -1141,119 +1492,713 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class RetryPolicy(Model): - """Information about the retry policy for an event subscription. - - :param max_delivery_attempts: Maximum number of delivery retry attempts - for events. - :type max_delivery_attempts: int - :param event_time_to_live_in_minutes: Time To Live (in minutes) for - events. - :type 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, *, max_delivery_attempts: int=None, event_time_to_live_in_minutes: int=None, **kwargs) -> None: - super(RetryPolicy, self).__init__(**kwargs) - self.max_delivery_attempts = max_delivery_attempts - self.event_time_to_live_in_minutes = event_time_to_live_in_minutes - +class PartnerNamespace(TrackedResource): + """EventGrid Partner Namespace. -class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus 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. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus destination of an event subscription. - :type resource_id: str + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the partner namespace. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerNamespaceProvisioningState + :param partner_registration_fully_qualified_id: The fully qualified ARM Id + of the partner registration that should be associated with this partner + namespace. This takes the following format: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. + :type partner_registration_fully_qualified_id: str + :ivar endpoint: Endpoint for the partner namespace. + :vartype endpoint: str """ _validation = { - 'endpoint_type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, } _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_registration_fully_qualified_id': {'key': 'properties.partnerRegistrationFullyQualifiedId', 'type': 'str'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: - super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) - self.resource_id = resource_id - self.endpoint_type = 'ServiceBusQueue' + def __init__(self, *, location: str, tags=None, partner_registration_fully_qualified_id: str=None, **kwargs) -> None: + super(PartnerNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.partner_registration_fully_qualified_id = partner_registration_fully_qualified_id + self.endpoint = None -class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the service bus topic destination for an event - subscription. +class PartnerNamespaceRegenerateKeyRequest(Model): + """PartnerNamespace regenerate shared access key request. All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource Id that represents the endpoint of - the Service Bus Topic destination of an event subscription. - :type resource_id: str + :param key_name: Required. Key name to regenerate (key1 or key2). + :type key_name: str """ _validation = { - 'endpoint_type': {'required': True}, + 'key_name': {'required': True}, } _attribute_map = { - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, **kwargs) -> None: - super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) - self.resource_id = resource_id - self.endpoint_type = 'ServiceBusTopic' - + def __init__(self, *, key_name: str, **kwargs) -> None: + super(PartnerNamespaceRegenerateKeyRequest, self).__init__(**kwargs) + self.key_name = key_name -class StorageBlobDeadLetterDestination(DeadLetterDestination): - """Information about the storage blob based dead letter destination. - All required parameters must be populated in order to send to Azure. +class PartnerNamespaceSharedAccessKeys(Model): + """Shared access keys of the partner namespace. - :param endpoint_type: Required. Constant filled by server. - :type endpoint_type: str - :param resource_id: The Azure Resource ID of the storage account that is - the destination of the deadletter events - :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is - the destination of the deadletter events - :type blob_container_name: str + :param key1: Shared access key1 for the partner namespace. + :type key1: str + :param key2: Shared access key2 for the partner namespace. + :type key2: 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'}, + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, blob_container_name: str=None, **kwargs) -> None: - super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) - self.resource_id = resource_id - self.blob_container_name = blob_container_name - self.endpoint_type = 'StorageBlob' + def __init__(self, *, key1: str=None, key2: str=None, **kwargs) -> None: + super(PartnerNamespaceSharedAccessKeys, self).__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 -class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): - """Information about the storage queue destination for an event subscription. +class PartnerNamespaceUpdateParameters(Model): + """Properties of the PartnerNamespace update. + + :param tags: Tags of the partner namespace. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(PartnerNamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class PartnerRegistration(TrackedResource): + """Information about a partner registration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the partner registration. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationProvisioningState + :param partner_name: Official name of the partner name. For example: + "Contoso". + :type partner_name: str + :param partner_resource_type_name: Name of the partner resource type. + :type partner_resource_type_name: str + :param partner_resource_type_display_name: Display name of the partner + resource type. + :type partner_resource_type_display_name: str + :param partner_resource_type_description: Description of the partner + resource type. + :type partner_resource_type_description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param logo_uri: URI of the logo. + :type logo_uri: str + :param visibility_state: Visibility state of the partner registration. + Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' + :type visibility_state: str or + ~azure.mgmt.eventgrid.models.PartnerRegistrationVisibilityState + :param authorized_azure_subscription_ids: List of Azure subscription Ids + that are authorized to create a partner namespace + associated with this partner registration. This is an optional property. + Creating + partner namespaces is always permitted under the same Azure subscription + as the one used + for creating the partner registration. + :type authorized_azure_subscription_ids: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, + 'partner_resource_type_name': {'key': 'properties.partnerResourceTypeName', 'type': 'str'}, + 'partner_resource_type_display_name': {'key': 'properties.partnerResourceTypeDisplayName', 'type': 'str'}, + 'partner_resource_type_description': {'key': 'properties.partnerResourceTypeDescription', 'type': 'str'}, + 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, + 'logo_uri': {'key': 'properties.logoUri', 'type': 'str'}, + 'visibility_state': {'key': 'properties.visibilityState', 'type': 'str'}, + 'authorized_azure_subscription_ids': {'key': 'properties.authorizedAzureSubscriptionIds', 'type': '[str]'}, + } + + def __init__(self, *, location: str, tags=None, partner_name: str=None, partner_resource_type_name: str=None, partner_resource_type_display_name: str=None, partner_resource_type_description: str=None, setup_uri: str=None, logo_uri: str=None, visibility_state=None, authorized_azure_subscription_ids=None, **kwargs) -> None: + super(PartnerRegistration, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.partner_name = partner_name + self.partner_resource_type_name = partner_resource_type_name + self.partner_resource_type_display_name = partner_resource_type_display_name + self.partner_resource_type_description = partner_resource_type_description + self.setup_uri = setup_uri + self.logo_uri = logo_uri + self.visibility_state = visibility_state + self.authorized_azure_subscription_ids = authorized_azure_subscription_ids + + +class PartnerRegistrationEventTypesListResult(Model): + """Result of the List Partner Registration Event Types operation. + + :param value: A collection of partner registration event types. + :type value: list[~azure.mgmt.eventgrid.models.EventType] + :param next_link: A link for the next page of partner registration event + types. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(PartnerRegistrationEventTypesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartnerRegistrationUpdateParameters(Model): + """Properties of the Partner Registration update. + + :param partner_topic_type_name: Name of the partner topic type. + :type partner_topic_type_name: str + :param partner_topic_type_display_name: Display name of the partner topic + type. + :type partner_topic_type_display_name: str + :param partner_topic_type_description: Description of the partner topic + type. + :type partner_topic_type_description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param logo_uri: URI of the partner logo. + :type logo_uri: str + :param authorized_azure_subscription_ids: List of IDs of Azure AD + applications that are authorized to create a partner namespace + associated with this partner registration. This is an optional property. + Creating + partner namespaces is always permitted under the same Azure subscription + as the one used + for creating the partner registration. + :type authorized_azure_subscription_ids: list[str] + """ + + _attribute_map = { + '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, *, partner_topic_type_name: str=None, partner_topic_type_display_name: str=None, partner_topic_type_description: str=None, setup_uri: str=None, logo_uri: str=None, authorized_azure_subscription_ids=None, **kwargs) -> None: + super(PartnerRegistrationUpdateParameters, self).__init__(**kwargs) + self.partner_topic_type_name = partner_topic_type_name + self.partner_topic_type_display_name = partner_topic_type_display_name + self.partner_topic_type_description = partner_topic_type_description + self.setup_uri = setup_uri + self.logo_uri = logo_uri + self.authorized_azure_subscription_ids = authorized_azure_subscription_ids + + +class PartnerTopic(TrackedResource): + """EventGrid Partner Topic. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :param source: Source associated with this partner topic. This represents + a unique partner resource. + :type source: str + :ivar provisioning_state: Provisioning state of the partner topic. + Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicProvisioningState + :param activation_state: Activation state of the partner topic. Possible + values include: 'NeverActivated', 'Activated', 'Deactivated' + :type activation_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicActivationState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'activation_state': {'key': 'properties.activationState', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, source: str=None, activation_state=None, **kwargs) -> None: + super(PartnerTopic, self).__init__(location=location, tags=tags, **kwargs) + self.source = source + self.provisioning_state = None + self.activation_state = activation_state - All required parameters must be populated in order to send to Azure. + +class PartnerTopicType(Resource): + """Properties of a partner topic type. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param partner_name: Official name of the partner. + :type partner_name: str + :param topic_type_name: Name of the partner topic type. This name should + be unique among all partner topic types names. + :type topic_type_name: str + :param display_name: Display Name for the partner topic type. + :type display_name: str + :param description: Description of the partner topic type. + :type description: str + :param setup_uri: URI of the partner website that can be used by Azure + customers to setup Event Grid + integration on an event source. + :type setup_uri: str + :param authorization_state: Status of whether the customer has authorized + a partner to create partner topics + in the customer's subscription. Possible values include: 'NotApplicable', + 'NotAuthorized', 'Authorized' + :type authorization_state: str or + ~azure.mgmt.eventgrid.models.PartnerTopicTypeAuthorizationState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partner_name': {'key': 'properties.partnerName', 'type': 'str'}, + 'topic_type_name': {'key': 'properties.topicTypeName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'setup_uri': {'key': 'properties.setupUri', 'type': 'str'}, + 'authorization_state': {'key': 'properties.authorizationState', 'type': 'str'}, + } + + def __init__(self, *, partner_name: str=None, topic_type_name: str=None, display_name: str=None, description: str=None, setup_uri: str=None, authorization_state=None, **kwargs) -> None: + super(PartnerTopicType, self).__init__(**kwargs) + self.partner_name = partner_name + self.topic_type_name = topic_type_name + self.display_name = display_name + self.description = description + self.setup_uri = setup_uri + self.authorization_state = authorization_state + + +class PartnerTopicTypesListResult(Model): + """Result of the List Partner Topic Types operation. + + :param value: A collection of partner topic types. + :type value: list[~azure.mgmt.eventgrid.models.PartnerTopicType] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PartnerTopicType]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(PartnerTopicTypesListResult, self).__init__(**kwargs) + self.value = value + + +class PartnerTopicUpdateParameters(Model): + """Properties of the Partner Topic update. + + :param tags: Tags of the partner topic. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(PartnerTopicUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class PrivateEndpoint(Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(Resource): + """PrivateEndpointConnection resource information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param private_endpoint: The Private Endpoint resource for this + Connection. + :type private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :param group_ids: GroupIds from the private link service resource. + :type group_ids: list[str] + :param private_link_service_connection_state: Details about the state of + the connection. + :type private_link_service_connection_state: + ~azure.mgmt.eventgrid.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint + Connection. Possible values include: 'Creating', 'Updating', 'Deleting', + 'Succeeded', 'Canceled', 'Failed' + :type provisioning_state: str or + ~azure.mgmt.eventgrid.models.ResourceProvisioningState + """ + + _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, *, private_endpoint=None, group_ids=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.group_ids = group_ids + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateLinkResource(Model): + """Information of the private link resource. + + :param group_id: + :type group_id: str + :param display_name: + :type display_name: str + :param required_members: + :type required_members: list[str] + :param required_zone_names: + :type required_zone_names: list[str] + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource + :type name: str + :param type: Type of the resource + :type type: str + """ + + _attribute_map = { + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, group_id: str=None, display_name: str=None, required_members=None, required_zone_names=None, id: str=None, name: str=None, type: str=None, **kwargs) -> None: + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = group_id + self.display_name = display_name + self.required_members = required_members + self.required_zone_names = required_zone_names + self.id = id + self.name = name + self.type = type + + +class ResourceSku(Model): + """Describes an EventGrid Resource Sku. + + :param name: the Sku name of the resource. + the possible values: Basic; Premium. Possible values include: 'Basic', + 'Premium' + :type name: str or ~azure.mgmt.eventgrid.models.Sku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name=None, **kwargs) -> None: + super(ResourceSku, self).__init__(**kwargs) + self.name = name + + +class RetryPolicy(Model): + """Information about the retry policy for an event subscription. + + :param max_delivery_attempts: Maximum number of delivery retry attempts + for events. + :type max_delivery_attempts: int + :param event_time_to_live_in_minutes: Time To Live (in minutes) for + events. + :type 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, *, max_delivery_attempts: int=None, event_time_to_live_in_minutes: int=None, **kwargs) -> None: + super(RetryPolicy, self).__init__(**kwargs) + self.max_delivery_attempts = max_delivery_attempts + self.event_time_to_live_in_minutes = event_time_to_live_in_minutes + + +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. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource Id that represents the endpoint of + the Service Bus destination of an event subscription. + :type resource_id: str + """ + + _validation = { + 'endpoint_type': {'required': True}, + } + + _attribute_map = { + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, *, resource_id: str=None, **kwargs) -> None: + super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) + self.resource_id = resource_id + self.endpoint_type = 'ServiceBusQueue' + + +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. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource Id that represents the endpoint of + the Service Bus Topic destination of an event subscription. + :type resource_id: str + """ + + _validation = { + 'endpoint_type': {'required': True}, + } + + _attribute_map = { + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + } + + def __init__(self, *, resource_id: str=None, **kwargs) -> None: + super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) + self.resource_id = resource_id + self.endpoint_type = 'ServiceBusTopic' + + +class SkuDefinitionsForResourceType(Model): + """Describes an EventGrid Resource Sku Definition. + + :param resource_type: The Resource Type applicable for the Sku. + :type resource_type: str + :param skus: The Sku pricing tiers for the resource type. + :type skus: list[~azure.mgmt.eventgrid.models.ResourceSku] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[ResourceSku]'}, + } + + def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + super(SkuDefinitionsForResourceType, self).__init__(**kwargs) + self.resource_type = resource_type + self.skus = skus + + +class SkuDefinitionsForResourceTypeListResult(Model): + """List collection of Sku Definitions for each Resource Type. + + :param value: A collection of Sku Definitions for each Resource Type. + :type value: + list[~azure.mgmt.eventgrid.models.SkuDefinitionsForResourceType] + :param next_link: A link for the next page of Sku Definitions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDefinitionsForResourceType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(SkuDefinitionsForResourceTypeListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class StorageBlobDeadLetterDestination(DeadLetterDestination): + """Information about the storage blob based dead letter destination. + + All required parameters must be populated in order to send to Azure. + + :param endpoint_type: Required. Constant filled by server. + :type endpoint_type: str + :param resource_id: The Azure Resource ID of the storage account that is + the destination of the deadletter events + :type resource_id: str + :param blob_container_name: The name of the Storage blob container that is + the destination of the deadletter events + :type 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, *, resource_id: str=None, blob_container_name: str=None, **kwargs) -> None: + super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) + self.resource_id = resource_id + self.blob_container_name = blob_container_name + self.endpoint_type = 'StorageBlob' + + +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. :param endpoint_type: Required. Constant filled by server. :type endpoint_type: str @@ -1432,6 +2377,82 @@ def __init__(self, *, key: str=None, values=None, **kwargs) -> None: self.operator_type = 'StringNotIn' +class SystemTopic(TrackedResource): + """EventGrid System Topic. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource + :vartype name: str + :ivar type: Type of the resource + :vartype type: str + :param location: Required. Location of the resource. + :type location: str + :param tags: Tags of the resource. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the system topic. Possible + values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + 'Canceled', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :param source: Source for the system topic. + :type source: str + :param topic_type: TopicType for the system topic. + :type topic_type: str + :ivar metric_resource_id: Metric resource id for the system topic. + :vartype metric_resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'metric_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'topic_type': {'key': 'properties.topicType', 'type': 'str'}, + 'metric_resource_id': {'key': 'properties.metricResourceId', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, source: str=None, topic_type: str=None, **kwargs) -> None: + super(SystemTopic, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.source = source + self.topic_type = topic_type + self.metric_resource_id = None + + +class SystemTopicUpdateParameters(Model): + """Properties of the System Topic update. + + :param tags: Tags of the system topic. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(SystemTopicUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + class Topic(TrackedResource): """EventGrid Topic. @@ -1450,6 +2471,9 @@ class Topic(TrackedResource): :type location: str :param tags: Tags of the resource. :type tags: dict[str, str] + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] :ivar provisioning_state: Provisioning state of the topic. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' @@ -1470,13 +2494,21 @@ class Topic(TrackedResource): ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - to be applied when events are received on this topic. + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the topic. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku + :param identity: Identity information for the resource. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _validation = { @@ -1495,24 +2527,30 @@ class Topic(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, - 'allow_traffic_from_all_ips': {'key': 'properties.allowTrafficFromAllIPs', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, } - def __init__(self, *, location: str, tags=None, input_schema="EventGridSchema", input_schema_mapping=None, allow_traffic_from_all_ips: bool=None, inbound_ip_rules=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, private_endpoint_connections=None, input_schema="EventGridSchema", input_schema_mapping=None, public_network_access=None, inbound_ip_rules=None, sku=None, identity=None, **kwargs) -> None: super(Topic, self).__init__(location=location, tags=tags, **kwargs) + self.private_endpoint_connections = private_endpoint_connections self.provisioning_state = None self.endpoint = None self.input_schema = input_schema self.input_schema_mapping = input_schema_mapping self.metric_resource_id = None - self.allow_traffic_from_all_ips = allow_traffic_from_all_ips + self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules + self.sku = sku + self.identity = identity class TopicRegenerateKeyRequest(Model): @@ -1626,26 +2664,58 @@ class TopicUpdateParameters(Model): :param tags: Tags of the resource. :type tags: dict[str, str] - :param allow_traffic_from_all_ips: This determines if IP filtering rules - ought to be evaluated or not. By default it will not evaluate and will - allow traffic from all IPs. - :type allow_traffic_from_all_ips: bool - :param inbound_ip_rules: This determines the IP filtering rules that ought - be applied when events are received on this domain. + :param identity: Resource identity information. + :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :param public_network_access: This determines if traffic is allowed over + public network. By default it is enabled. + You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :param inbound_ip_rules: This can be used to restrict traffic from + specific IPs instead of all IPs. Note: These are considered only if + PublicNetworkAccess is enabled. :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :param sku: The Sku pricing tier for the topic. + :type sku: ~azure.mgmt.eventgrid.models.ResourceSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'allow_traffic_from_all_ips': {'key': 'allowTrafficFromAllIPs', 'type': 'bool'}, - 'inbound_ip_rules': {'key': 'inboundIpRules', 'type': '[InboundIpRule]'}, + 'identity': {'key': 'identity', 'type': 'IdentityInfo'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'inbound_ip_rules': {'key': 'properties.inboundIpRules', 'type': '[InboundIpRule]'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, } - def __init__(self, *, tags=None, allow_traffic_from_all_ips: bool=None, inbound_ip_rules=None, **kwargs) -> None: + def __init__(self, *, tags=None, identity=None, public_network_access=None, inbound_ip_rules=None, sku=None, **kwargs) -> None: super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = tags - self.allow_traffic_from_all_ips = allow_traffic_from_all_ips + self.identity = identity + self.public_network_access = public_network_access self.inbound_ip_rules = inbound_ip_rules + self.sku = sku + + +class UserIdentityProperties(Model): + """The information about the user identity. + + :param principal_id: The principal id of user assigned identity. + :type principal_id: str + :param client_id: The client id of user assigned identity. + :type client_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: + super(UserIdentityProperties, self).__init__(**kwargs) + self.principal_id = principal_id + self.client_id = client_id class WebHookEventSubscriptionDestination(EventSubscriptionDestination): diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py index 51d07add2ef3..20d75dc4b167 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_paged_models.py @@ -38,6 +38,19 @@ class DomainTopicPaged(Paged): def __init__(self, *args, **kwargs): super(DomainTopicPaged, self).__init__(*args, **kwargs) +class EventChannelPaged(Paged): + """ + A paging container for iterating over a list of :class:`EventChannel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[EventChannel]'} + } + + def __init__(self, *args, **kwargs): + + super(EventChannelPaged, self).__init__(*args, **kwargs) class EventSubscriptionPaged(Paged): """ A paging container for iterating over a list of :class:`EventSubscription ` object @@ -64,6 +77,84 @@ class OperationPaged(Paged): def __init__(self, *args, **kwargs): super(OperationPaged, self).__init__(*args, **kwargs) +class PartnerNamespacePaged(Paged): + """ + A paging container for iterating over a list of :class:`PartnerNamespace ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartnerNamespace]'} + } + + def __init__(self, *args, **kwargs): + + super(PartnerNamespacePaged, self).__init__(*args, **kwargs) +class PartnerRegistrationPaged(Paged): + """ + A paging container for iterating over a list of :class:`PartnerRegistration ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartnerRegistration]'} + } + + def __init__(self, *args, **kwargs): + + super(PartnerRegistrationPaged, self).__init__(*args, **kwargs) +class PartnerTopicPaged(Paged): + """ + A paging container for iterating over a list of :class:`PartnerTopic ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PartnerTopic]'} + } + + def __init__(self, *args, **kwargs): + + super(PartnerTopicPaged, self).__init__(*args, **kwargs) +class PrivateEndpointConnectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) +class PrivateLinkResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateLinkResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) +class SystemTopicPaged(Paged): + """ + A paging container for iterating over a list of :class:`SystemTopic ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SystemTopic]'} + } + + def __init__(self, *args, **kwargs): + + super(SystemTopicPaged, self).__init__(*args, **kwargs) class TopicPaged(Paged): """ A paging container for iterating over a list of :class:`Topic ` object diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py index fae2cb13aafd..6a4607f4a8ba 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py @@ -11,16 +11,36 @@ from ._domains_operations import DomainsOperations from ._domain_topics_operations import DomainTopicsOperations +from ._event_channels_operations import EventChannelsOperations from ._event_subscriptions_operations import EventSubscriptionsOperations +from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations +from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations from ._operations import Operations +from ._partner_namespaces_operations import PartnerNamespacesOperations +from ._partner_registrations_operations import PartnerRegistrationsOperations +from ._partner_topics_operations import PartnerTopicsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._system_topics_operations import SystemTopicsOperations from ._topics_operations import TopicsOperations +from ._extension_topics_operations import ExtensionTopicsOperations from ._topic_types_operations import TopicTypesOperations __all__ = [ 'DomainsOperations', 'DomainTopicsOperations', + 'EventChannelsOperations', 'EventSubscriptionsOperations', + 'SystemTopicEventSubscriptionsOperations', + 'PartnerTopicEventSubscriptionsOperations', 'Operations', + 'PartnerNamespacesOperations', + 'PartnerRegistrationsOperations', + 'PartnerTopicsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'SystemTopicsOperations', 'TopicsOperations', + 'ExtensionTopicsOperations', 'TopicTypesOperations', ] 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 47cfdd92a297..0b21e61ec836 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 @@ -325,7 +325,7 @@ def _update_initial( request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200, 201]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp 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..25f10bb4882d --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_channels_operations.py @@ -0,0 +1,333 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class EventChannelsOperations(object): + """EventChannelsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, partner_namespace_name, event_channel_name, custom_headers=None, raw=False, **operation_config): + """Get an event channel. + + Get properties of an event channel. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param event_channel_name: Name of the event channel. + :type event_channel_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventChannel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventChannel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), + 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventChannel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} + + def create_or_update( + self, resource_group_name, partner_namespace_name, event_channel_name, event_channel_info, custom_headers=None, raw=False, **operation_config): + """Create an event channel. + + Asynchronously creates a new event channel with the specified + parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param event_channel_name: Name of the event channel. + :type event_channel_name: str + :param event_channel_info: EventChannel information. + :type event_channel_info: ~azure.mgmt.eventgrid.models.EventChannel + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventChannel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventChannel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), + 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(event_channel_info, 'EventChannel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventChannel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} + + def delete( + self, resource_group_name, partner_namespace_name, event_channel_name, custom_headers=None, raw=False, **operation_config): + """Delete an event channel. + + Delete existing event channel. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param event_channel_name: Name of the event channel. + :type event_channel_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str'), + 'eventChannelName': self._serialize.url("event_channel_name", event_channel_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}'} + + def list_by_partner_namespace( + self, resource_group_name, partner_namespace_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List event channels. + + List all the event channels in a partner namespace. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EventChannel + :rtype: + ~azure.mgmt.eventgrid.models.EventChannelPaged[~azure.mgmt.eventgrid.models.EventChannel] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_partner_namespace.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventChannelPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_partner_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py new file mode 100644 index 000000000000..1187598fafbb --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ExtensionTopicsOperations(object): + """ExtensionTopicsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, scope, custom_headers=None, raw=False, **operation_config): + """Get properties of an extension topic. + + Get the properties of an extension topic. + + :param scope: The identifier of the resource to which extension topic + is queried. The scope can be a subscription, or a resource group, or a + top level resource belonging to a resource provider namespace. For + example, use '/subscriptions/{subscriptionId}/' for a subscription, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for a resource group, and + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + for Azure resource. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ExtensionTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ExtensionTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py new file mode 100644 index 000000000000..4195f26749c5 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py @@ -0,0 +1,713 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PartnerNamespacesOperations(object): + """PartnerNamespacesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): + """Get a partner namespace. + + Get properties of a partner namespace. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerNamespace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} + + + def _create_or_update_initial( + self, resource_group_name, partner_namespace_name, partner_namespace_info, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(partner_namespace_info, 'PartnerNamespace') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PartnerNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, partner_namespace_name, partner_namespace_info, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a partner namespace. + + Asynchronously creates a new partner namespace with the specified + parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param partner_namespace_info: PartnerNamespace information. + :type partner_namespace_info: + ~azure.mgmt.eventgrid.models.PartnerNamespace + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns PartnerNamespace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PartnerNamespace]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + partner_namespace_info=partner_namespace_info, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PartnerNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} + + + def _delete_initial( + self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete a partner namespace. + + Delete existing partner namespace. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} + + + def _update_initial( + self, resource_group_name, partner_namespace_name, tags=None, custom_headers=None, raw=False, **operation_config): + partner_namespace_update_parameters = models.PartnerNamespaceUpdateParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(partner_namespace_update_parameters, 'PartnerNamespaceUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PartnerNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, partner_namespace_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Update a partner namespace. + + Asynchronously updates a partner namespace with the specified + parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param tags: Tags of the partner namespace. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns PartnerNamespace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PartnerNamespace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PartnerNamespace]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + partner_namespace_name=partner_namespace_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PartnerNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}'} + + def list_by_subscription( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner namespaces under an Azure subscription. + + List all the partner namespaces under an Azure subscription. + + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerNamespace + :rtype: + ~azure.mgmt.eventgrid.models.PartnerNamespacePaged[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces'} + + def list_by_resource_group( + self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner namespaces under a resource group. + + List all the partner namespaces under a resource group. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerNamespace + :rtype: + ~azure.mgmt.eventgrid.models.PartnerNamespacePaged[~azure.mgmt.eventgrid.models.PartnerNamespace] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces'} + + def list_shared_access_keys( + self, resource_group_name, partner_namespace_name, custom_headers=None, raw=False, **operation_config): + """List keys for a partner namespace. + + List the two keys used to publish to a partner namespace. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerNamespaceSharedAccessKeys or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_shared_access_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerNamespaceSharedAccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys'} + + def regenerate_key( + self, resource_group_name, partner_namespace_name, key_name, custom_headers=None, raw=False, **operation_config): + """Regenerate key for a partner namespace. + + Regenerate a shared access key for a partner namespace. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_namespace_name: Name of the partner namespace. + :type partner_namespace_name: str + :param key_name: Key name to regenerate (key1 or key2). + :type key_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerNamespaceSharedAccessKeys or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + regenerate_key_request = models.PartnerNamespaceRegenerateKeyRequest(key_name=key_name) + + # Construct URL + url = self.regenerate_key.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerNamespaceName': self._serialize.url("partner_namespace_name", partner_namespace_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(regenerate_key_request, 'PartnerNamespaceRegenerateKeyRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerNamespaceSharedAccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py new file mode 100644 index 000000000000..9bd6e57dfd24 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py @@ -0,0 +1,545 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PartnerRegistrationsOperations(object): + """PartnerRegistrationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, partner_registration_name, custom_headers=None, raw=False, **operation_config): + """Get a partner registration. + + Gets a partner registration with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_registration_name: Name of the partner registration. + :type partner_registration_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerRegistration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerRegistration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} + + def create_or_update( + self, resource_group_name, partner_registration_name, partner_registration_info, custom_headers=None, raw=False, **operation_config): + """Create a partner registration. + + Creates a new partner registration with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_registration_name: Name of the partner registration. + :type partner_registration_name: str + :param partner_registration_info: PartnerRegistration information. + :type partner_registration_info: + ~azure.mgmt.eventgrid.models.PartnerRegistration + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerRegistration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(partner_registration_info, 'PartnerRegistration') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerRegistration', response) + if response.status_code == 202: + deserialized = self._deserialize('PartnerRegistration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} + + def delete( + self, resource_group_name, partner_registration_name, custom_headers=None, raw=False, **operation_config): + """Delete a partner registration. + + Deletes a partner registration with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_registration_name: Name of the partner registration. + :type partner_registration_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} + + def update( + self, resource_group_name, partner_registration_name, partner_registration_update_parameters, custom_headers=None, raw=False, **operation_config): + """Update a partner registration. + + Updates a partner registration with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_registration_name: Name of the partner registration. + :type partner_registration_name: str + :param partner_registration_update_parameters: Partner registration + update information. + :type partner_registration_update_parameters: + ~azure.mgmt.eventgrid.models.PartnerRegistrationUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerRegistration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerRegistrationName': self._serialize.url("partner_registration_name", partner_registration_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(partner_registration_update_parameters, 'PartnerRegistrationUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('PartnerRegistration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}'} + + def list_by_subscription( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner registrations under an Azure subscription. + + List all the partner registrations under an Azure subscription. + + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerRegistration + :rtype: + ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations'} + + def list_by_resource_group( + self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner registrations under a resource group. + + List all the partner registrations under a resource group. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerRegistration + :rtype: + ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """List all available partners registrations. + + List all partners registrations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerRegistration + :rtype: + ~azure.mgmt.eventgrid.models.PartnerRegistrationPaged[~azure.mgmt.eventgrid.models.PartnerRegistration] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerRegistrationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.EventGrid/partnerRegistrations'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py new file mode 100644 index 000000000000..678c1fef122a --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py @@ -0,0 +1,567 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PartnerTopicEventSubscriptionsOperations(object): + """PartnerTopicEventSubscriptionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get an event subscription of a partner topic. + + Get an event subscription of a partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param event_subscription_name: Name of the event subscription to be + found. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _create_or_update_initial( + self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(event_subscription_info, 'EventSubscription') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an event subscription of a partner topic. + + Asynchronously creates or updates an event subscription of a partner + topic with the specified parameters. Existing event subscriptions will + be updated with this API. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param event_subscription_info: Event subscription properties + containing the destination and filter information. + :type event_subscription_info: + ~azure.mgmt.eventgrid.models.EventSubscription + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns EventSubscription or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _delete_initial( + self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete an event subscription of a partner topic. + + Delete an event subscription of a partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _update_initial( + self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, partner_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update event subscription of a partner topic. + + Update event subscription of a partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param event_subscription_update_parameters: Updated event + subscription information. + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns EventSubscription or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + def get_full_url( + self, resource_group_name, partner_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get full URL of an event subscription of a partner topic. + + Get the full endpoint URL for an event subscription of a partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventSubscriptionFullUrl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_full_url.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventSubscriptionFullUrl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} + + def list_by_partner_topic( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): + """List event subscriptions of a partner topic. + + List event subscriptions that belong to a specific partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EventSubscription + :rtype: + ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_partner_topic.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_partner_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py new file mode 100644 index 000000000000..763b8d9bdce2 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py @@ -0,0 +1,564 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PartnerTopicsOperations(object): + """PartnerTopicsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): + """Get a partner topic. + + Get properties of a partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} + + + def _delete_initial( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete a partner topic. + + Delete existing partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + partner_topic_name=partner_topic_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} + + def update( + self, resource_group_name, partner_topic_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Update a partner topic. + + Asynchronously updates a partner topic with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param tags: Tags of the partner topic. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + partner_topic_update_parameters = models.PartnerTopicUpdateParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(partner_topic_update_parameters, 'PartnerTopicUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('PartnerTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}'} + + def list_by_subscription( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner topics under an Azure subscription. + + List all the partner topics under an Azure subscription. + + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerTopic + :rtype: + ~azure.mgmt.eventgrid.models.PartnerTopicPaged[~azure.mgmt.eventgrid.models.PartnerTopic] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics'} + + def list_by_resource_group( + self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List partner topics under a resource group. + + List all the partner topics under a resource group. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PartnerTopic + :rtype: + ~azure.mgmt.eventgrid.models.PartnerTopicPaged[~azure.mgmt.eventgrid.models.PartnerTopic] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PartnerTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics'} + + def activate( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): + """Activate a partner topic. + + Activate a newly created partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.activate.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate'} + + def deactivate( + self, resource_group_name, partner_topic_name, custom_headers=None, raw=False, **operation_config): + """Deactivate a partner topic. + + Deactivate specific partner topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param partner_topic_name: Name of the partner topic. + :type partner_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PartnerTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.deactivate.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'partnerTopicName': self._serialize.url("partner_topic_name", partner_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PartnerTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..6aa90da3bc5f --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,416 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """Get a specific private endpoint connection. + + Get a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _update_initial( + self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Update a specific private endpoint connection. + + Update a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + PrivateEndpointConnection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.PrivateEndpointConnection]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _delete_initial( + self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, parent_type, parent_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete a specific private endpoint connection. + + Delete a specific private endpoint connection under a topic or domain. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def list_by_resource( + self, resource_group_name, parent_type, parent_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Lists all private endpoint connections under a resource. + + Get all private endpoint connections under a topic or domain. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections'} 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 new file mode 100644 index 000000000000..6500b3252ee9 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, parent_type, parent_name, private_link_resource_name, custom_headers=None, raw=False, **operation_config): + """Get a private link resource. + + Get properties of a private link resource. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param private_link_resource_name: The name of private link resource. + :type private_link_resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateLinkResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str'), + 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} + + def list_by_resource( + self, resource_group_name, parent_type, parent_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List private link resources under specific topic or domain. + + List all the private link resources under a topic or domain. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param parent_type: The type of the parent resource. This can be + either \\'topics\\' or \\'domains\\'. + :type parent_type: str + :param parent_name: The name of the parent resource (namely, either, + the topic name or domain name). + :type parent_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.mgmt.eventgrid.models.PrivateLinkResourcePaged[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'parentType': self._serialize.url("parent_type", parent_type, 'str'), + 'parentName': self._serialize.url("parent_name", parent_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PrivateLinkResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources'} 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 new file mode 100644 index 000000000000..94eb74dd3bb6 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py @@ -0,0 +1,567 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SystemTopicEventSubscriptionsOperations(object): + """SystemTopicEventSubscriptionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get an event subscription of a system topic. + + Get an event subscription. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _create_or_update_initial( + self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(event_subscription_info, 'EventSubscription') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_info, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update an event subscription for a system topic. + + Asynchronously creates or updates an event subscription with the + specified parameters. Existing event subscriptions will be updated with + this API. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param event_subscription_info: Event subscription properties + containing the destination and filter information. + :type event_subscription_info: + ~azure.mgmt.eventgrid.models.EventSubscription + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns EventSubscription or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + event_subscription_info=event_subscription_info, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _delete_initial( + self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete an event subscription of a system topic. + + Delete an event subscription of a system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + + def _update_initial( + self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, system_topic_name, event_subscription_name, event_subscription_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update event subscription of a system topic. + + Update event subscription of a system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param event_subscription_update_parameters: Updated event + subscription information. + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns EventSubscription or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.EventSubscription] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.EventSubscription]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + event_subscription_update_parameters=event_subscription_update_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('EventSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} + + def get_full_url( + self, resource_group_name, system_topic_name, event_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get full URL of an event subscription of a system topic. + + Get the full endpoint URL for an event subscription of a system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param event_subscription_name: Name of the event subscription to be + created. Event subscription names must be between 3 and 100 characters + in length and use alphanumeric letters only. + :type event_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EventSubscriptionFullUrl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_full_url.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), + 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EventSubscriptionFullUrl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} + + def list_by_system_topic( + self, resource_group_name, system_topic_name, custom_headers=None, raw=False, **operation_config): + """List event subscriptions of a system topic. + + List event subscriptions that belong to a specific system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EventSubscription + :rtype: + ~azure.mgmt.eventgrid.models.EventSubscriptionPaged[~azure.mgmt.eventgrid.models.EventSubscription] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_system_topic.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_system_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py new file mode 100644 index 000000000000..1d9b4643522f --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py @@ -0,0 +1,577 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SystemTopicsOperations(object): + """SystemTopicsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def get( + self, resource_group_name, system_topic_name, custom_headers=None, raw=False, **operation_config): + """Get a system topic. + + Get properties of a system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SystemTopic or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventgrid.models.SystemTopic or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SystemTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} + + + def _create_or_update_initial( + self, resource_group_name, system_topic_name, system_topic_info, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(system_topic_info, 'SystemTopic') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SystemTopic', response) + if response.status_code == 201: + deserialized = self._deserialize('SystemTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, system_topic_name, system_topic_info, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a system topic. + + Asynchronously creates a new system topic with the specified + parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param system_topic_info: System Topic information. + :type system_topic_info: ~azure.mgmt.eventgrid.models.SystemTopic + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SystemTopic or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.SystemTopic] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.SystemTopic]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + system_topic_info=system_topic_info, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SystemTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} + + + def _delete_initial( + self, resource_group_name, system_topic_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, system_topic_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete a system topic. + + Delete existing system topic. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} + + + def _update_initial( + self, resource_group_name, system_topic_name, tags=None, custom_headers=None, raw=False, **operation_config): + system_topic_update_parameters = models.SystemTopicUpdateParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SystemTopic', response) + if response.status_code == 201: + deserialized = self._deserialize('SystemTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, system_topic_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Update a system topic. + + Asynchronously updates a system topic with the specified parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param system_topic_name: Name of the system topic. + :type system_topic_name: str + :param tags: Tags of the system topic. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SystemTopic or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventgrid.models.SystemTopic] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventgrid.models.SystemTopic]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SystemTopic', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} + + def list_by_subscription( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List system topics under an Azure subscription. + + List all the system topics under an Azure subscription. + + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SystemTopic + :rtype: + ~azure.mgmt.eventgrid.models.SystemTopicPaged[~azure.mgmt.eventgrid.models.SystemTopic] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SystemTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics'} + + def list_by_resource_group( + self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """List system topics under a resource group. + + List all the system topics under a resource group. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param filter: The query used to filter the search results using OData + syntax. Filtering is permitted on the 'name' property only and with + limited number of OData operations. These operations are: the + 'contains' function as well as the following logical operations: not, + and, or, eq (for equal), and ne (for not equal). No arithmetic + operations are supported. The following is a valid filter example: + $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The + following is not a valid filter example: $filter=location eq 'westus'. + :type filter: str + :param top: The number of results to return per page for the list + operation. Valid range for top parameter is 1 to 100. If not + specified, the default number of results to be returned is 20 items + per page. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SystemTopic + :rtype: + ~azure.mgmt.eventgrid.models.SystemTopicPaged[~azure.mgmt.eventgrid.models.SystemTopic] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SystemTopicPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics'} diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py index bc4dcd964055..636333df52a3 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 @@ -324,7 +324,7 @@ def _update_initial( request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200, 201]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp 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 fc43877054a5..936dbeb88fea 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/version.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0rc4" +VERSION = "3.0.0rc5"