diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md index 8b3f6f391f36..dbd07c142828 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-mgmt-eventgrid/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 10.1.0 (2021-12-13) + +**Features** + + - Added model NumberInRangeAdvancedFilter + - Added model StringNotContainsAdvancedFilter + - Added model NumberNotInRangeAdvancedFilter + - Added model IsNullOrUndefinedAdvancedFilter + - Added model IsNotNullAdvancedFilter + - Added model StringNotBeginsWithAdvancedFilter + - Added model StringNotEndsWithAdvancedFilter + ## 10.0.0 (2021-10-21) **Features** diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json index 0e48c08287d4..33c73c768de8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "2f9b3758c1308560dd4ca2bebe112e9da9ac227f", + "commit": "f3477bd0a7b6101f9c0af243cc0106c7a8e24c71", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/eventgrid/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py index 6a0fbf411f3a..755903d6307d 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['EventGridManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py index 10ca73711dcc..a3549d2b8b08 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(EventGridManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(EventGridManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py index 9033fb0bda0d..a716cbef1493 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 @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import EventGridManagementClientConfiguration +from .operations import DomainTopicsOperations, DomainsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicTypesOperations, TopicsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import EventGridManagementClientConfiguration -from .operations import DomainsOperations -from .operations import DomainTopicsOperations -from .operations import EventSubscriptionsOperations -from .operations import SystemTopicEventSubscriptionsOperations -from .operations import Operations -from .operations import TopicsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import SystemTopicsOperations -from .operations import ExtensionTopicsOperations -from .operations import TopicTypesOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class EventGridManagementClient(object): """Azure EventGrid Management Client. @@ -43,13 +33,15 @@ class EventGridManagementClient(object): :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.operations.EventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations - :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations + :vartype system_topic_event_subscriptions: + azure.mgmt.eventgrid.operations.SystemTopicEventSubscriptionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.operations.Operations :ivar topics: TopicsOperations operations :vartype topics: azure.mgmt.eventgrid.operations.TopicsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.eventgrid.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.eventgrid.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.eventgrid.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations @@ -60,70 +52,69 @@ class EventGridManagementClient(object): :vartype topic_types: azure.mgmt.eventgrid.operations.TopicTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = EventGridManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = EventGridManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.domains = DomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.domain_topics = DomainTopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_subscriptions = EventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.system_topics = SystemTopicsOperations( - 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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_topics = DomainTopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event_subscriptions = EventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.system_topics = SystemTopicsOperations(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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json index a7b7004255af..f21a2d17a6b8 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_metadata.json @@ -5,13 +5,13 @@ "name": "EventGridManagementClient", "filename": "_event_grid_management_client", "description": "Azure EventGrid Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"EventGridManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"EventGridManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"EventGridManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"EventGridManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "domains": "DomainsOperations", diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) 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 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py index 4f2ff94fca75..e6434022dff3 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py @@ -8,3 +8,8 @@ from ._event_grid_management_client import EventGridManagementClient __all__ = ['EventGridManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py index a83b9bd57a14..cab82dd107c4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(EventGridManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(EventGridManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py index cda928965cc0..9d68649ac893 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import EventGridManagementClientConfiguration +from .operations import DomainTopicsOperations, DomainsOperations, EventSubscriptionsOperations, ExtensionTopicsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SystemTopicEventSubscriptionsOperations, SystemTopicsOperations, TopicTypesOperations, TopicsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import EventGridManagementClientConfiguration -from .operations import DomainsOperations -from .operations import DomainTopicsOperations -from .operations import EventSubscriptionsOperations -from .operations import SystemTopicEventSubscriptionsOperations -from .operations import Operations -from .operations import TopicsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import SystemTopicsOperations -from .operations import ExtensionTopicsOperations -from .operations import TopicTypesOperations -from .. import models - - -class EventGridManagementClient(object): +class EventGridManagementClient: """Azure EventGrid Management Client. :ivar domains: DomainsOperations operations @@ -41,15 +31,18 @@ class EventGridManagementClient(object): :ivar event_subscriptions: EventSubscriptionsOperations operations :vartype event_subscriptions: azure.mgmt.eventgrid.aio.operations.EventSubscriptionsOperations :ivar system_topic_event_subscriptions: SystemTopicEventSubscriptionsOperations operations - :vartype system_topic_event_subscriptions: azure.mgmt.eventgrid.aio.operations.SystemTopicEventSubscriptionsOperations + :vartype system_topic_event_subscriptions: + azure.mgmt.eventgrid.aio.operations.SystemTopicEventSubscriptionsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.eventgrid.aio.operations.Operations :ivar topics: TopicsOperations operations :vartype topics: azure.mgmt.eventgrid.aio.operations.TopicsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.eventgrid.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.eventgrid.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.eventgrid.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.eventgrid.aio.operations.PrivateLinkResourcesOperations :ivar system_topics: SystemTopicsOperations operations :vartype system_topics: azure.mgmt.eventgrid.aio.operations.SystemTopicsOperations :ivar extension_topics: ExtensionTopicsOperations operations @@ -58,68 +51,67 @@ class EventGridManagementClient(object): :vartype topic_types: azure.mgmt.eventgrid.aio.operations.TopicTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = EventGridManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = EventGridManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.domain_topics = DomainTopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.event_subscriptions = EventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.system_topics = SystemTopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_topics = ExtensionTopicsOperations(self._client, self._config, self._serialize, self._deserialize) + self.topic_types = TopicTypesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.domains = DomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.domain_topics = DomainTopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_subscriptions = EventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.system_topic_event_subscriptions = SystemTopicEventSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.system_topics = SystemTopicsOperations( - 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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py index 5f853211822b..d806c0a33376 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._domain_topics_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,28 +76,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -119,28 +117,18 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -154,8 +142,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -175,15 +166,18 @@ async def begin_create_or_update( :type domain_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DomainTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DomainTopic or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.DomainTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -198,25 +192,17 @@ async def begin_create_or_update( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DomainTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +214,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore async def _delete_initial( @@ -242,26 +229,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,6 +253,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -293,15 +274,17 @@ async def begin_delete( :type domain_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -316,22 +299,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -343,8 +318,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + @distributed_trace def list_by_domain( self, resource_group_name: str, @@ -373,8 +350,10 @@ def list_by_domain( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DomainTopicsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.DomainTopicsListResult] + :return: An iterator like instance of either DomainTopicsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.DomainTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainTopicsListResult"] @@ -382,40 +361,37 @@ def list_by_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + filter=filter, + top=top, + template_url=self.list_by_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DomainTopicsListResult', pipeline_response) + deserialized = self._deserialize("DomainTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -433,6 +409,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py index 78c06c90006a..e4ad6182880f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_shared_access_keys_request, build_regenerate_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,27 +73,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +97,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -115,32 +113,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(domain_info, 'Domain') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_info, 'Domain') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -154,8 +142,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -175,15 +166,19 @@ async def begin_create_or_update( :type domain_info: ~azure.mgmt.eventgrid.models.Domain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Domain or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Domain] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Domain"] lro_delay = kwargs.pop( 'polling_interval', @@ -195,27 +190,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, domain_name=domain_name, domain_info=domain_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Domain', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -227,6 +216,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore async def _delete_initial( @@ -240,25 +230,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -271,6 +253,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -287,15 +271,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -309,21 +295,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,6 +314,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore async def _update_initial( @@ -349,32 +329,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,8 +360,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -411,15 +384,19 @@ async def begin_update( :type domain_update_parameters: ~azure.mgmt.eventgrid.models.DomainUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Domain or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Domain] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Domain"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,27 +408,21 @@ async def begin_update( resource_group_name=resource_group_name, domain_name=domain_name, domain_update_parameters=domain_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Domain', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -463,8 +434,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, @@ -496,38 +469,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DomainsListResult', pipeline_response) + deserialized = self._deserialize("DomainsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,11 +513,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -584,39 +554,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DomainsListResult', pipeline_response) + deserialized = self._deserialize("DomainsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -634,11 +600,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'} # type: ignore + @distributed_trace_async async def list_shared_access_keys( self, resource_group_name: str, @@ -663,27 +631,17 @@ async def list_shared_access_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_shared_access_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +655,11 @@ async def list_shared_access_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -726,32 +687,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key_request, 'DomainRegenerateKeyRequest') + + request = build_regenerate_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_request, 'DomainRegenerateKeyRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -765,4 +716,6 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py index 17025055c46b..e1933fca74fa 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_by_domain_topic_request, build_list_by_resource_request, build_list_global_by_resource_group_for_topic_type_request, build_list_global_by_resource_group_request, build_list_global_by_subscription_for_topic_type_request, build_list_global_by_subscription_request, build_list_regional_by_resource_group_for_topic_type_request, build_list_regional_by_resource_group_request, build_list_regional_by_subscription_for_topic_type_request, build_list_regional_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, scope: str, @@ -74,26 +80,16 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +103,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + async def _create_or_update_initial( self, scope: str, @@ -121,31 +119,21 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -159,8 +147,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, scope: str, @@ -191,15 +182,19 @@ async def begin_create_or_update( :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -211,26 +206,21 @@ async def begin_create_or_update( scope=scope, event_subscription_name=event_subscription_name, event_subscription_info=event_subscription_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,6 +232,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore async def _delete_initial( @@ -255,24 +246,16 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -285,6 +268,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, scope: str, @@ -308,15 +293,17 @@ async def begin_delete( :type event_subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -330,20 +317,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +336,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore async def _update_initial( @@ -369,31 +351,21 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -407,8 +379,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, scope: str, @@ -432,18 +407,23 @@ async def begin_update( :param event_subscription_name: Name of the event subscription to be updated. :type event_subscription_name: str :param event_subscription_update_parameters: Updated event subscription information. - :type event_subscription_update_parameters: ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -455,26 +435,21 @@ async def begin_update( scope=scope, event_subscription_name=event_subscription_name, event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -486,8 +461,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + @distributed_trace_async async def get_full_url( self, scope: str, @@ -519,26 +496,16 @@ async def get_full_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_full_url.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_full_url_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -552,8 +519,11 @@ async def get_full_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_full_url.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + @distributed_trace def list_global_by_subscription( self, filter: Optional[str] = None, @@ -576,8 +546,10 @@ def list_global_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -585,38 +557,33 @@ def list_global_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_global_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -634,11 +601,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_global_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_subscription_for_topic_type( self, topic_type_name: str, @@ -664,8 +633,10 @@ def list_global_by_subscription_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -673,39 +644,35 @@ def list_global_by_subscription_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_subscription_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_global_by_subscription_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -723,11 +690,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_global_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_resource_group( self, resource_group_name: str, @@ -753,8 +722,10 @@ def list_global_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -762,39 +733,35 @@ def list_global_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_global_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -812,11 +779,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_global_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_resource_group_for_topic_type( self, resource_group_name: str, @@ -845,8 +814,10 @@ def list_global_by_resource_group_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -854,40 +825,37 @@ def list_global_by_resource_group_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_resource_group_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_global_by_resource_group_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,11 +873,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_global_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_subscription( self, location: str, @@ -935,8 +905,10 @@ def list_regional_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -944,39 +916,35 @@ def list_regional_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_request( + subscription_id=self._config.subscription_id, + location=location, + filter=filter, + top=top, + template_url=self.list_regional_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_request( + subscription_id=self._config.subscription_id, + location=location, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -994,11 +962,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_regional_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_resource_group( self, resource_group_name: str, @@ -1028,8 +998,10 @@ def list_regional_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -1037,40 +1009,37 @@ def list_regional_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + filter=filter, + top=top, + template_url=self.list_regional_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1088,11 +1057,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_regional_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_subscription_for_topic_type( self, location: str, @@ -1122,8 +1093,10 @@ def list_regional_by_subscription_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -1131,40 +1104,37 @@ def list_regional_by_subscription_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_subscription_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_regional_by_subscription_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1182,11 +1152,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_regional_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_resource_group_for_topic_type( self, resource_group_name: str, @@ -1196,7 +1168,8 @@ def list_regional_by_resource_group_for_topic_type( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.EventSubscriptionsListResult"]: - """List all regional event subscriptions under an Azure subscription and resource group for a topic type. + """List all regional event subscriptions under an Azure subscription and resource group for a + topic type. List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. @@ -1219,8 +1192,10 @@ def list_regional_by_resource_group_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -1228,41 +1203,39 @@ def list_regional_by_resource_group_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_resource_group_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_regional_by_resource_group_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1280,11 +1253,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_regional_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -1319,8 +1294,10 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -1328,42 +1305,41 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), - 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1381,11 +1357,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_by_domain_topic( self, resource_group_name: str, @@ -1417,8 +1395,10 @@ def list_by_domain_topic( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -1426,41 +1406,39 @@ def list_by_domain_topic( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_domain_topic.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + filter=filter, + top=top, + template_url=self.list_by_domain_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1478,11 +1456,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_domain_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace_async async def get_delivery_attributes( self, scope: str, @@ -1514,26 +1494,16 @@ async def get_delivery_attributes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_delivery_attributes.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_delivery_attributes_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1547,4 +1517,6 @@ async def get_delivery_attributes( return cls(pipeline_response, deserialized, {}) return deserialized + get_delivery_attributes.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py index 773131d2e61b..801ade923857 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extension_topics_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, scope: str, @@ -66,25 +71,15 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + scope=scope, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,4 +93,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py index 440f520d14d6..f7d0c4058187 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -50,8 +56,10 @@ def list( List the available operations supported by the Microsoft.EventGrid resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.OperationsListResult] + :return: An iterator like instance of either OperationsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.OperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsListResult"] @@ -59,30 +67,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsListResult', pipeline_response) + deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py index 9c5bbac5b620..6e1e59d3f32c 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -76,29 +82,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +108,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -128,34 +126,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,8 +161,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -203,15 +194,20 @@ async def begin_update( :type private_endpoint_connection: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -225,29 +221,21 @@ async def begin_update( parent_name=parent_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -259,6 +247,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -274,27 +263,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,6 +288,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -332,15 +315,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -356,23 +341,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -384,8 +360,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -419,8 +397,10 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -428,41 +408,39 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -480,6 +458,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py index a39080af4b5a..42c3cc1daeb1 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_by_resource_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -73,29 +79,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +105,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -144,8 +143,10 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] @@ -153,41 +154,39 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -205,6 +204,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py index 29ea52dd2a4f..ab3c6afbc7d2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._system_topic_event_subscriptions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_delivery_attributes_request, build_get_full_url_request, build_get_request, build_list_by_system_topic_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,28 +78,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +103,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -122,33 +120,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +150,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -190,15 +181,19 @@ async def begin_create_or_update( :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -211,28 +206,21 @@ async def begin_create_or_update( system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, event_subscription_info=event_subscription_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -244,6 +232,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore async def _delete_initial( @@ -258,26 +247,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,6 +271,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -311,15 +294,17 @@ async def begin_delete( :type event_subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -334,22 +319,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -361,6 +338,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore async def _update_initial( @@ -376,33 +354,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -416,8 +384,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -439,18 +410,23 @@ async def begin_update( 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 + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,28 +439,21 @@ async def begin_update( system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,8 +465,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + @distributed_trace_async async def get_full_url( self, resource_group_name: str, @@ -527,28 +498,18 @@ async def get_full_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_full_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -562,8 +523,11 @@ async def get_full_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + @distributed_trace def list_by_system_topic( self, resource_group_name: str, @@ -592,8 +556,10 @@ def list_by_system_topic( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscriptionsListResult"] @@ -601,40 +567,37 @@ def list_by_system_topic( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_system_topic.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_system_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + filter=filter, + top=top, + template_url=self.list_by_system_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_system_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -652,11 +615,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_system_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions'} # type: ignore + @distributed_trace_async async def get_delivery_attributes( self, resource_group_name: str, @@ -686,28 +651,18 @@ async def get_delivery_attributes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_delivery_attributes.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -721,4 +676,6 @@ async def get_delivery_attributes( return cls(pipeline_response, deserialized, {}) return deserialized + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py index 01b34ef2d498..5adf5991ed4f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._system_topics_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,27 +73,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +97,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -115,32 +113,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(system_topic_info, 'SystemTopic') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(system_topic_info, 'SystemTopic') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,8 +146,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -179,15 +170,19 @@ async def begin_create_or_update( :type system_topic_info: ~azure.mgmt.eventgrid.models.SystemTopic :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SystemTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SystemTopic or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.SystemTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -199,27 +194,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, system_topic_name=system_topic_name, system_topic_info=system_topic_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SystemTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -231,6 +220,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore async def _delete_initial( @@ -244,25 +234,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -275,6 +257,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -291,15 +275,17 @@ async def begin_delete( :type system_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,21 +299,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,6 +318,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore async def _update_initial( @@ -353,32 +333,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,8 +366,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,15 +390,19 @@ async def begin_update( :type system_topic_update_parameters: ~azure.mgmt.eventgrid.models.SystemTopicUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SystemTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SystemTopic or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.SystemTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -437,27 +414,21 @@ async def begin_update( resource_group_name=resource_group_name, system_topic_name=system_topic_name, system_topic_update_parameters=system_topic_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SystemTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -469,8 +440,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, @@ -493,8 +466,10 @@ def list_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SystemTopicsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] + :return: An iterator like instance of either SystemTopicsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopicsListResult"] @@ -502,38 +477,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SystemTopicsListResult', pipeline_response) + deserialized = self._deserialize("SystemTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -551,11 +521,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -581,8 +553,10 @@ def list_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SystemTopicsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] + :return: An iterator like instance of either SystemTopicsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopicsListResult"] @@ -590,39 +564,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SystemTopicsListResult', pipeline_response) + deserialized = self._deserialize("SystemTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -640,6 +610,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py index a7b44aebdc51..b316bf2a5c5f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._topic_types_operations import build_get_request, build_list_event_types_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -50,8 +56,10 @@ def list( List all registered topic types. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopicTypesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.TopicTypesListResult] + :return: An iterator like instance of either TopicTypesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.TopicTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicTypesListResult"] @@ -59,30 +67,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TopicTypesListResult', pipeline_response) + deserialized = self._deserialize("TopicTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,11 +105,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes'} # type: ignore + @distributed_trace_async async def get( self, topic_type_name: str, @@ -126,25 +133,15 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + topic_type_name=topic_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -158,8 +155,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}'} # type: ignore + + @distributed_trace def list_event_types( self, topic_type_name: str, @@ -172,8 +172,10 @@ def list_event_types( :param topic_type_name: Name of the topic type. :type topic_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventTypesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :return: An iterator like instance of either EventTypesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventTypesListResult"] @@ -181,34 +183,29 @@ def list_event_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_event_types.metadata['url'] # type: ignore - path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + topic_type_name=topic_type_name, + template_url=self.list_event_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + topic_type_name=topic_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventTypesListResult', pipeline_response) + deserialized = self._deserialize("EventTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -226,6 +223,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py index f3750a5bda98..ca99a5ead9f4 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._topics_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_event_types_request, build_list_shared_access_keys_request, build_regenerate_key_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,27 +73,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,8 +97,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -115,32 +113,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(topic_info, 'Topic') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(topic_info, 'Topic') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -154,8 +142,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -175,15 +166,18 @@ async def begin_create_or_update( :type topic_info: ~azure.mgmt.eventgrid.models.Topic :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Topic or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Topic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Topic"] lro_delay = kwargs.pop( 'polling_interval', @@ -195,27 +189,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, topic_name=topic_name, topic_info=topic_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Topic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -227,6 +215,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore async def _delete_initial( @@ -240,25 +229,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -271,6 +252,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -287,15 +270,17 @@ async def begin_delete( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -309,21 +294,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,6 +313,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore async def _update_initial( @@ -349,32 +328,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -390,8 +359,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -411,15 +383,18 @@ async def begin_update( :type topic_update_parameters: ~azure.mgmt.eventgrid.models.TopicUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Topic or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.Topic] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Topic"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,27 +406,21 @@ async def begin_update( resource_group_name=resource_group_name, topic_name=topic_name, topic_update_parameters=topic_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Topic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -463,8 +432,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, @@ -496,38 +467,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TopicsListResult', pipeline_response) + deserialized = self._deserialize("TopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -545,11 +511,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -584,39 +552,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TopicsListResult', pipeline_response) + deserialized = self._deserialize("TopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -634,11 +598,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'} # type: ignore + @distributed_trace_async async def list_shared_access_keys( self, resource_group_name: str, @@ -663,27 +629,17 @@ async def list_shared_access_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_shared_access_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -697,8 +653,10 @@ async def list_shared_access_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'} # type: ignore + async def _regenerate_key_initial( self, resource_group_name: str, @@ -711,32 +669,22 @@ async def _regenerate_key_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._regenerate_key_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key_request, 'TopicRegenerateKeyRequest') + + request = build_regenerate_key_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._regenerate_key_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_request, 'TopicRegenerateKeyRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -750,8 +698,11 @@ async def _regenerate_key_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def begin_regenerate_key( self, resource_group_name: str, @@ -771,15 +722,19 @@ async def begin_regenerate_key( :type regenerate_key_request: ~azure.mgmt.eventgrid.models.TopicRegenerateKeyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either TopicSharedAccessKeys or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TopicSharedAccessKeys or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventgrid.models.TopicSharedAccessKeys] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicSharedAccessKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -791,27 +746,21 @@ async def begin_regenerate_key( resource_group_name=resource_group_name, topic_name=topic_name, regenerate_key_request=regenerate_key_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -823,8 +772,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore + @distributed_trace def list_event_types( self, resource_group_name: str, @@ -846,8 +797,10 @@ def list_event_types( :param resource_name: Name of the topic. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventTypesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] + :return: An iterator like instance of either EventTypesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventTypesListResult"] @@ -855,38 +808,37 @@ def list_event_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_event_types.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), - 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + template_url=self.list_event_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EventTypesListResult', pipeline_response) + deserialized = self._deserialize("EventTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -904,6 +856,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 132a81b28d47..d0098742df38 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 @@ -39,15 +39,19 @@ from ._models_py3 import IdentityInfo from ._models_py3 import InboundIpRule from ._models_py3 import InputSchemaMapping + from ._models_py3 import IsNotNullAdvancedFilter + from ._models_py3 import IsNullOrUndefinedAdvancedFilter from ._models_py3 import JsonField from ._models_py3 import JsonFieldWithDefault from ._models_py3 import JsonInputSchemaMapping from ._models_py3 import NumberGreaterThanAdvancedFilter from ._models_py3 import NumberGreaterThanOrEqualsAdvancedFilter from ._models_py3 import NumberInAdvancedFilter + from ._models_py3 import NumberInRangeAdvancedFilter from ._models_py3 import NumberLessThanAdvancedFilter from ._models_py3 import NumberLessThanOrEqualsAdvancedFilter from ._models_py3 import NumberNotInAdvancedFilter + from ._models_py3 import NumberNotInRangeAdvancedFilter from ._models_py3 import Operation from ._models_py3 import OperationInfo from ._models_py3 import OperationsListResult @@ -67,6 +71,9 @@ from ._models_py3 import StringContainsAdvancedFilter from ._models_py3 import StringEndsWithAdvancedFilter from ._models_py3 import StringInAdvancedFilter + from ._models_py3 import StringNotBeginsWithAdvancedFilter + from ._models_py3 import StringNotContainsAdvancedFilter + from ._models_py3 import StringNotEndsWithAdvancedFilter from ._models_py3 import StringNotInAdvancedFilter from ._models_py3 import SystemData from ._models_py3 import SystemTopic @@ -115,15 +122,19 @@ from ._models import IdentityInfo # type: ignore from ._models import InboundIpRule # type: ignore from ._models import InputSchemaMapping # type: ignore + from ._models import IsNotNullAdvancedFilter # type: ignore + from ._models import IsNullOrUndefinedAdvancedFilter # type: ignore from ._models import JsonField # type: ignore from ._models import JsonFieldWithDefault # type: ignore from ._models import JsonInputSchemaMapping # type: ignore from ._models import NumberGreaterThanAdvancedFilter # type: ignore from ._models import NumberGreaterThanOrEqualsAdvancedFilter # type: ignore from ._models import NumberInAdvancedFilter # type: ignore + from ._models import NumberInRangeAdvancedFilter # type: ignore from ._models import NumberLessThanAdvancedFilter # type: ignore from ._models import NumberLessThanOrEqualsAdvancedFilter # type: ignore from ._models import NumberNotInAdvancedFilter # type: ignore + from ._models import NumberNotInRangeAdvancedFilter # type: ignore from ._models import Operation # type: ignore from ._models import OperationInfo # type: ignore from ._models import OperationsListResult # type: ignore @@ -143,6 +154,9 @@ from ._models import StringContainsAdvancedFilter # type: ignore from ._models import StringEndsWithAdvancedFilter # type: ignore from ._models import StringInAdvancedFilter # type: ignore + from ._models import StringNotBeginsWithAdvancedFilter # type: ignore + from ._models import StringNotContainsAdvancedFilter # type: ignore + from ._models import StringNotEndsWithAdvancedFilter # type: ignore from ._models import StringNotInAdvancedFilter # type: ignore from ._models import SystemData # type: ignore from ._models import SystemTopic # type: ignore @@ -220,15 +234,19 @@ 'IdentityInfo', 'InboundIpRule', 'InputSchemaMapping', + 'IsNotNullAdvancedFilter', + 'IsNullOrUndefinedAdvancedFilter', 'JsonField', 'JsonFieldWithDefault', 'JsonInputSchemaMapping', 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberInAdvancedFilter', + 'NumberInRangeAdvancedFilter', 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotInAdvancedFilter', + 'NumberNotInRangeAdvancedFilter', 'Operation', 'OperationInfo', 'OperationsListResult', @@ -248,6 +266,9 @@ 'StringContainsAdvancedFilter', 'StringEndsWithAdvancedFilter', 'StringInAdvancedFilter', + 'StringNotBeginsWithAdvancedFilter', + 'StringNotContainsAdvancedFilter', + 'StringNotEndsWithAdvancedFilter', 'StringNotInAdvancedFilter', 'SystemData', 'SystemTopic', 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 5ab2e4a26964..465f1f4faa00 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 @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AdvancedFilterOperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AdvancedFilterOperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. """ @@ -42,8 +27,15 @@ class AdvancedFilterOperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, E STRING_BEGINS_WITH = "StringBeginsWith" STRING_ENDS_WITH = "StringEndsWith" STRING_CONTAINS = "StringContains" - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + NUMBER_IN_RANGE = "NumberInRange" + NUMBER_NOT_IN_RANGE = "NumberNotInRange" + STRING_NOT_BEGINS_WITH = "StringNotBeginsWith" + STRING_NOT_ENDS_WITH = "StringNotEndsWith" + STRING_NOT_CONTAINS = "StringNotContains" + IS_NULL_OR_UNDEFINED = "IsNullOrUndefined" + IS_NOT_NULL = "IsNotNull" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,20 +44,20 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeadLetterEndPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeadLetterEndPointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the endpoint for the dead letter destination """ STORAGE_BLOB = "StorageBlob" -class DeliveryAttributeMappingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeliveryAttributeMappingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the delivery attribute or header name. """ STATIC = "Static" DYNAMIC = "Dynamic" -class DomainProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DomainProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Event Grid Domain Resource. """ @@ -76,7 +68,7 @@ class DomainProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CANCELED = "Canceled" FAILED = "Failed" -class DomainTopicProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DomainTopicProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the domain topic. """ @@ -87,7 +79,7 @@ class DomainTopicProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CANCELED = "Canceled" FAILED = "Failed" -class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the endpoint for the event subscription destination. """ @@ -99,27 +91,27 @@ class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE_BUS_TOPIC = "ServiceBusTopic" AZURE_FUNCTION = "AzureFunction" -class Enum18(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum18(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TOPICS = "topics" DOMAINS = "domains" -class Enum19(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum19(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TOPICS = "topics" DOMAINS = "domains" -class Enum20(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum20(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TOPICS = "topics" DOMAINS = "domains" -class Enum21(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum21(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TOPICS = "topics" DOMAINS = "domains" -class EventDeliverySchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventDeliverySchema(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The event delivery schema for the event subscription. """ @@ -127,7 +119,7 @@ class EventDeliverySchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CUSTOM_INPUT_SCHEMA = "CustomInputSchema" CLOUD_EVENT_SCHEMA_V1_0 = "CloudEventSchemaV1_0" -class EventSubscriptionIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventSubscriptionIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -136,7 +128,7 @@ class EventSubscriptionIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class EventSubscriptionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventSubscriptionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the event subscription. """ @@ -148,7 +140,7 @@ class EventSubscriptionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta FAILED = "Failed" AWAITING_MANUAL_ACTION = "AwaitingManualAction" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """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. @@ -159,7 +151,7 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class InputSchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InputSchema(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This determines the format that Event Grid should expect for incoming events published to the domain. """ @@ -168,19 +160,19 @@ class InputSchema(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CUSTOM_EVENT_SCHEMA = "CustomEventSchema" CLOUD_EVENT_SCHEMA_V1_0 = "CloudEventSchemaV1_0" -class InputSchemaMappingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InputSchemaMappingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the custom mapping """ JSON = "Json" -class IpActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IpActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Action to perform based on the match or no match of the IpMask. """ ALLOW = "Allow" -class PersistedConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PersistedConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the connection. """ @@ -189,7 +181,7 @@ class PersistedConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, En REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. 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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. - :type disable_local_auth: bool - :param auto_create_topic_with_first_subscription: This Boolean is used to specify the creation + :vartype disable_local_auth: bool + :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, creation of domain topic can be auto-managed (when true) or self-managed @@ -475,8 +547,8 @@ class Domain(TrackedResource): flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the domain topic on demand if needed. - :type auto_create_topic_with_first_subscription: bool - :param auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + :vartype auto_create_topic_with_first_subscription: bool + :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, deletion of domain topic can be auto-managed (when true) or self-managed @@ -490,7 +562,7 @@ class Domain(TrackedResource): control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer resources by the user. - :type auto_delete_topic_with_last_subscription: bool + :vartype auto_delete_topic_with_last_subscription: bool """ _validation = { @@ -530,6 +602,64 @@ def __init__( self, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the Event Grid Domain resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword input_schema: This determines the format that Event Grid should expect for incoming + events published to the domain. Possible values include: "EventGridSchema", + "CustomEventSchema", "CloudEventSchemaV1_0". + :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :keyword input_schema_mapping: Information about the InputSchemaMapping which specified the + info about mapping event payload. + :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the domain. + :paramtype disable_local_auth: bool + :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the + creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid + Domain resource. + In this context, creation of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is null or set to true, Event Grid is responsible of automatically creating + the domain topic when the first event subscription is + created at the scope of the domain topic. If this property is set to false, then creating the + first event subscription will require creating a domain topic + by the user. The self-management mode can be used if the user wants full control of when the + domain topic is created, while auto-managed mode provides the + flexibility to perform less operations and manage fewer resources by the user. Also, note that + in auto-managed creation mode, user is allowed to create the + domain topic on demand if needed. + :paramtype auto_create_topic_with_first_subscription: bool + :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain + resource. + In this context, deletion of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is set to true, Event Grid is responsible of automatically deleting the + domain topic when the last event subscription at the scope + of the domain topic is deleted. If this property is set to false, then the user needs to + manually delete the domain topic when it is no longer needed + (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The + self-management mode can be used if the user wants full + control of when the domain topic needs to be deleted, while auto-managed mode provides the + flexibility to perform less operations and manage fewer + resources by the user. + :paramtype auto_delete_topic_with_last_subscription: bool + """ super(Domain, self).__init__(**kwargs) self.system_data = None self.identity = kwargs.get('identity', None) @@ -551,8 +681,8 @@ class DomainRegenerateKeyRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2. - :type key_name: str + :ivar key_name: Required. Key name to regenerate key1 or key2. + :vartype key_name: str """ _validation = { @@ -567,6 +697,10 @@ def __init__( self, **kwargs ): + """ + :keyword key_name: Required. Key name to regenerate key1 or key2. + :paramtype key_name: str + """ super(DomainRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = kwargs['key_name'] @@ -574,10 +708,10 @@ def __init__( class DomainSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Domain. - :param key1: Shared access key1 for the domain. - :type key1: str - :param key2: Shared access key2 for the domain. - :type key2: str + :ivar key1: Shared access key1 for the domain. + :vartype key1: str + :ivar key2: Shared access key2 for the domain. + :vartype key2: str """ _attribute_map = { @@ -589,6 +723,12 @@ def __init__( self, **kwargs ): + """ + :keyword key1: Shared access key1 for the domain. + :paramtype key1: str + :keyword key2: Shared access key2 for the domain. + :paramtype key2: str + """ super(DomainSharedAccessKeys, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -597,10 +737,10 @@ def __init__( class DomainsListResult(msrest.serialization.Model): """Result of the List Domains operation. - :param value: A collection of Domains. - :type value: list[~azure.mgmt.eventgrid.models.Domain] - :param next_link: A link for the next page of domains. - :type next_link: str + :ivar value: A collection of Domains. + :vartype value: list[~azure.mgmt.eventgrid.models.Domain] + :ivar next_link: A link for the next page of domains. + :vartype next_link: str """ _attribute_map = { @@ -612,6 +752,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of Domains. + :paramtype value: list[~azure.mgmt.eventgrid.models.Domain] + :keyword next_link: A link for the next page of domains. + :paramtype next_link: str + """ super(DomainsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -655,6 +801,8 @@ def __init__( self, **kwargs ): + """ + """ super(DomainTopic, self).__init__(**kwargs) self.system_data = None self.provisioning_state = None @@ -663,10 +811,10 @@ def __init__( class DomainTopicsListResult(msrest.serialization.Model): """Result of the List Domain Topics operation. - :param value: A collection of Domain Topics. - :type value: list[~azure.mgmt.eventgrid.models.DomainTopic] - :param next_link: A link for the next page of domain topics. - :type next_link: str + :ivar value: A collection of Domain Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :ivar next_link: A link for the next page of domain topics. + :vartype next_link: str """ _attribute_map = { @@ -678,6 +826,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of Domain Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :keyword next_link: A link for the next page of domain topics. + :paramtype next_link: str + """ super(DomainTopicsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -686,24 +840,24 @@ def __init__( class DomainUpdateParameters(msrest.serialization.Model): """Properties of the Domain update. - :param tags: A set of tags. Tags of the domains resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar tags: A set of tags. Tags of the domains resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. - :type disable_local_auth: bool - :param auto_create_topic_with_first_subscription: This Boolean is used to specify the creation + :vartype disable_local_auth: bool + :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, creation of domain topic can be auto-managed (when true) or self-managed @@ -717,8 +871,8 @@ class DomainUpdateParameters(msrest.serialization.Model): flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the domain topic on demand if needed. - :type auto_create_topic_with_first_subscription: bool - :param auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + :vartype auto_create_topic_with_first_subscription: bool + :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, deletion of domain topic can be auto-managed (when true) or self-managed @@ -732,7 +886,7 @@ class DomainUpdateParameters(msrest.serialization.Model): control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer resources by the user. - :type auto_delete_topic_with_last_subscription: bool + :vartype auto_delete_topic_with_last_subscription: bool """ _attribute_map = { @@ -749,6 +903,55 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the domains resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the domain. + :paramtype disable_local_auth: bool + :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the + creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid + Domain resource. + In this context, creation of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is null or set to true, Event Grid is responsible of automatically creating + the domain topic when the first event subscription is + created at the scope of the domain topic. If this property is set to false, then creating the + first event subscription will require creating a domain topic + by the user. The self-management mode can be used if the user wants full control of when the + domain topic is created, while auto-managed mode provides the + flexibility to perform less operations and manage fewer resources by the user. Also, note that + in auto-managed creation mode, user is allowed to create the + domain topic on demand if needed. + :paramtype auto_create_topic_with_first_subscription: bool + :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain + resource. + In this context, deletion of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is set to true, Event Grid is responsible of automatically deleting the + domain topic when the last event subscription at the scope + of the domain topic is deleted. If this property is set to false, then the user needs to + manually delete the domain topic when it is no longer needed + (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The + self-management mode can be used if the user wants full + control of when the domain topic needs to be deleted, while auto-managed mode provides the + flexibility to perform less operations and manage fewer + resources by the user. + :paramtype auto_delete_topic_with_last_subscription: bool + """ super(DomainUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.identity = kwargs.get('identity', None) @@ -764,13 +967,13 @@ class DynamicDeliveryAttributeMapping(DeliveryAttributeMapping): All required parameters must be populated in order to send to Azure. - :param name: Name of the delivery attribute or header. - :type name: str - :param type: Required. Type of the delivery attribute or header name.Constant filled by server. + :ivar name: Name of the delivery attribute or header. + :vartype name: str + :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. Possible values include: "Static", "Dynamic". - :type type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :param source_field: JSON path in the event which contains attribute value. - :type source_field: str + :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType + :ivar source_field: JSON path in the event which contains attribute value. + :vartype source_field: str """ _validation = { @@ -787,6 +990,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the delivery attribute or header. + :paramtype name: str + :keyword source_field: JSON path in the event which contains attribute value. + :paramtype source_field: str + """ super(DynamicDeliveryAttributeMapping, self).__init__(**kwargs) self.type = 'Dynamic' # type: str self.source_field = kwargs.get('source_field', None) @@ -797,15 +1006,16 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -822,6 +1032,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(EventHubEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'EventHub' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -848,35 +1066,35 @@ class EventSubscription(Resource): "AwaitingManualAction". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState - :param destination: Information about the destination where events have to be delivered for the + :ivar destination: Information about the destination where events have to be delivered for the event subscription. - :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination where events have to + :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :ivar delivery_with_resource_identity: Information about the destination where events have to be delivered for the event subscription. Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type delivery_with_resource_identity: + :vartype 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. - :type labels: list[str] - :param expiration_time_utc: Expiration time of the event subscription. - :type expiration_time_utc: ~datetime.datetime - :param event_delivery_schema: The event delivery schema for the event subscription. Possible + :ivar filter: Information about the filter for the event subscription. + :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :ivar labels: List of user defined labels. + :vartype labels: list[str] + :ivar expiration_time_utc: Expiration time of the event subscription. + :vartype expiration_time_utc: ~datetime.datetime + :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to configure maximum number + :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :ivar retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event subscription. - :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of the event + :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :ivar dead_letter_destination: The DeadLetter destination of the event subscription. + :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :ivar dead_letter_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type dead_letter_with_resource_identity: + :vartype dead_letter_with_resource_identity: ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ @@ -911,6 +1129,38 @@ def __init__( self, **kwargs ): + """ + :keyword destination: Information about the destination where events have to be delivered for + the event subscription. + :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :keyword delivery_with_resource_identity: Information about the destination where events have + to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire + the authentication tokens being used during delivery / dead-lettering. + :paramtype delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :keyword filter: Information about the filter for the event subscription. + :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :keyword labels: List of user defined labels. + :paramtype labels: list[str] + :keyword expiration_time_utc: Expiration time of the event subscription. + :paramtype expiration_time_utc: ~datetime.datetime + :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :keyword retry_policy: The retry policy for events. This can be used to configure maximum + number of delivery attempts and time to live for events. + :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :keyword dead_letter_destination: The DeadLetter destination of the event subscription. + :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :keyword dead_letter_with_resource_identity: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is sent to the dead letter + destination. + Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire + the authentication tokens being used during delivery / dead-lettering. + :paramtype dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + """ super(EventSubscription, self).__init__(**kwargs) self.system_data = None self.topic = None @@ -929,29 +1179,29 @@ def __init__( class EventSubscriptionFilter(msrest.serialization.Model): """Filter for the Event Subscription. - :param subject_begins_with: An optional string to filter events for an event subscription based + :ivar subject_begins_with: An optional string to filter events for an event subscription based on a resource path prefix. The format of this depends on the publisher of the events. Wildcard characters are not supported in this path. - :type subject_begins_with: str - :param subject_ends_with: An optional string to filter events for an event subscription based - on a resource path suffix. + :vartype subject_begins_with: str + :ivar subject_ends_with: An optional string to filter events for an event subscription based on + a resource path suffix. Wildcard characters are not supported in this path. - :type subject_ends_with: str - :param included_event_types: A list of applicable event types that need to be part of the event + :vartype subject_ends_with: str + :ivar included_event_types: A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - :type included_event_types: list[str] - :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + :vartype included_event_types: list[str] + :ivar is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter should be compared in a case sensitive manner. - :type is_subject_case_sensitive: bool - :param enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against an + :vartype is_subject_case_sensitive: bool + :ivar enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. - :type enable_advanced_filtering_on_arrays: bool - :param advanced_filters: An array of advanced filters that are used for filtering event + :vartype enable_advanced_filtering_on_arrays: bool + :ivar advanced_filters: An array of advanced filters that are used for filtering event subscriptions. - :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + :vartype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] """ _attribute_map = { @@ -967,6 +1217,31 @@ def __init__( self, **kwargs ): + """ + :keyword subject_begins_with: An optional string to filter events for an event subscription + based on a resource path prefix. + The format of this depends on the publisher of the events. + Wildcard characters are not supported in this path. + :paramtype subject_begins_with: str + :keyword subject_ends_with: An optional string to filter events for an event subscription based + on a resource path suffix. + Wildcard characters are not supported in this path. + :paramtype subject_ends_with: str + :keyword included_event_types: A list of applicable event types that need to be part of the + event subscription. If it is desired to subscribe to all default event types, set the + IncludedEventTypes to null. + :paramtype included_event_types: list[str] + :keyword is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + properties of the filter + should be compared in a case sensitive manner. + :paramtype is_subject_case_sensitive: bool + :keyword enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against + an array of values instead of expecting a singular value. + :paramtype enable_advanced_filtering_on_arrays: bool + :keyword advanced_filters: An array of advanced filters that are used for filtering event + subscriptions. + :paramtype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + """ super(EventSubscriptionFilter, self).__init__(**kwargs) self.subject_begins_with = kwargs.get('subject_begins_with', None) self.subject_ends_with = kwargs.get('subject_ends_with', None) @@ -979,9 +1254,9 @@ def __init__( class EventSubscriptionFullUrl(msrest.serialization.Model): """Full endpoint url of an event subscription. - :param endpoint_url: The URL that represents the endpoint of the destination of an event + :ivar endpoint_url: The URL that represents the endpoint of the destination of an event subscription. - :type endpoint_url: str + :vartype endpoint_url: str """ _attribute_map = { @@ -992,6 +1267,11 @@ def __init__( self, **kwargs ): + """ + :keyword endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. + :paramtype endpoint_url: str + """ super(EventSubscriptionFullUrl, self).__init__(**kwargs) self.endpoint_url = kwargs.get('endpoint_url', None) @@ -999,12 +1279,12 @@ def __init__( class EventSubscriptionIdentity(msrest.serialization.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 + :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user-assigned identities. The type 'None' will + remove any identity. Possible values include: "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :ivar user_assigned_identity: The user identity associated with the resource. + :vartype user_assigned_identity: str """ _attribute_map = { @@ -1016,6 +1296,14 @@ def __init__( self, **kwargs ): + """ + :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user-assigned identities. The type + 'None' will remove any identity. Possible values include: "SystemAssigned", "UserAssigned". + :paramtype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :keyword user_assigned_identity: The user identity associated with the resource. + :paramtype user_assigned_identity: str + """ super(EventSubscriptionIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.user_assigned_identity = kwargs.get('user_assigned_identity', None) @@ -1024,10 +1312,10 @@ def __init__( class EventSubscriptionsListResult(msrest.serialization.Model): """Result of the List EventSubscriptions operation. - :param value: A collection of EventSubscriptions. - :type value: list[~azure.mgmt.eventgrid.models.EventSubscription] - :param next_link: A link for the next page of event subscriptions. - :type next_link: str + :ivar value: A collection of EventSubscriptions. + :vartype value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :ivar next_link: A link for the next page of event subscriptions. + :vartype next_link: str """ _attribute_map = { @@ -1039,6 +1327,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of EventSubscriptions. + :paramtype value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :keyword next_link: A link for the next page of event subscriptions. + :paramtype next_link: str + """ super(EventSubscriptionsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1047,35 +1341,35 @@ def __init__( class EventSubscriptionUpdateParameters(msrest.serialization.Model): """Properties of the Event Subscription update. - :param destination: Information about the destination where events have to be delivered for the + :ivar destination: Information about the destination where events have to be delivered for the event subscription. - :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination where events have to + :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :ivar delivery_with_resource_identity: Information about the destination where events have to be delivered for the event subscription. Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type delivery_with_resource_identity: + :vartype 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. - :type labels: list[str] - :param expiration_time_utc: Information about the expiration time for the event subscription. - :type expiration_time_utc: ~datetime.datetime - :param event_delivery_schema: The event delivery schema for the event subscription. Possible + :ivar filter: Information about the filter for the event subscription. + :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :ivar labels: List of user defined labels. + :vartype labels: list[str] + :ivar expiration_time_utc: Information about the expiration time for the event subscription. + :vartype expiration_time_utc: ~datetime.datetime + :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to configure maximum number + :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :ivar retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event subscription. - :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of the event + :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :ivar dead_letter_destination: The DeadLetter destination of the event subscription. + :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :ivar dead_letter_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type dead_letter_with_resource_identity: + :vartype dead_letter_with_resource_identity: ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ @@ -1095,6 +1389,38 @@ def __init__( self, **kwargs ): + """ + :keyword destination: Information about the destination where events have to be delivered for + the event subscription. + :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :keyword delivery_with_resource_identity: Information about the destination where events have + to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (topic / domain) to acquire the + authentication tokens being used during delivery / dead-lettering. + :paramtype delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :keyword filter: Information about the filter for the event subscription. + :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :keyword labels: List of user defined labels. + :paramtype labels: list[str] + :keyword expiration_time_utc: Information about the expiration time for the event subscription. + :paramtype expiration_time_utc: ~datetime.datetime + :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :keyword retry_policy: The retry policy for events. This can be used to configure maximum + number of delivery attempts and time to live for events. + :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :keyword dead_letter_destination: The DeadLetter destination of the event subscription. + :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :keyword dead_letter_with_resource_identity: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is sent to the dead letter + destination. + Uses the managed identity setup on the parent resource (topic / domain) to acquire the + authentication tokens being used during delivery / dead-lettering. + :paramtype dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + """ super(EventSubscriptionUpdateParameters, self).__init__(**kwargs) self.destination = kwargs.get('destination', None) self.delivery_with_resource_identity = kwargs.get('delivery_with_resource_identity', None) @@ -1118,14 +1444,14 @@ class EventType(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param display_name: Display name of the event type. - :type display_name: str - :param description: Description of the event type. - :type description: str - :param schema_url: Url of the schema for this event type. - :type schema_url: str - :param is_in_default_set: IsInDefaultSet flag of the event type. - :type is_in_default_set: bool + :ivar display_name: Display name of the event type. + :vartype display_name: str + :ivar description: Description of the event type. + :vartype description: str + :ivar schema_url: Url of the schema for this event type. + :vartype schema_url: str + :ivar is_in_default_set: IsInDefaultSet flag of the event type. + :vartype is_in_default_set: bool """ _validation = { @@ -1148,6 +1474,16 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Display name of the event type. + :paramtype display_name: str + :keyword description: Description of the event type. + :paramtype description: str + :keyword schema_url: Url of the schema for this event type. + :paramtype schema_url: str + :keyword is_in_default_set: IsInDefaultSet flag of the event type. + :paramtype is_in_default_set: bool + """ super(EventType, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -1158,8 +1494,8 @@ def __init__( class EventTypesListResult(msrest.serialization.Model): """Result of the List Event Types operation. - :param value: A collection of event types. - :type value: list[~azure.mgmt.eventgrid.models.EventType] + :ivar value: A collection of event types. + :vartype value: list[~azure.mgmt.eventgrid.models.EventType] """ _attribute_map = { @@ -1170,6 +1506,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of event types. + :paramtype value: list[~azure.mgmt.eventgrid.models.EventType] + """ super(EventTypesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1187,10 +1527,10 @@ class ExtensionTopic(Resource): :vartype type: str :ivar system_data: The system metadata relating to the Extension Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :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 + :ivar description: Description of the extension topic. + :vartype description: str + :ivar system_topic: System topic resource id which is mapped to the source. + :vartype system_topic: str """ _validation = { @@ -1213,6 +1553,12 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the extension topic. + :paramtype description: str + :keyword system_topic: System topic resource id which is mapped to the source. + :paramtype system_topic: str + """ super(ExtensionTopic, self).__init__(**kwargs) self.system_data = None self.description = kwargs.get('description', None) @@ -1224,15 +1570,16 @@ class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination) All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource ID of an hybrid connection that is the destination of an + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -1249,6 +1596,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of an hybrid connection that is the destination of + an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(HybridConnectionEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'HybridConnection' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -1258,20 +1613,21 @@ def __init__( class IdentityInfo(msrest.serialization.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 + :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user-assigned identities. The type 'None' will + remove any identity. Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.eventgrid.models.IdentityType + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. This property is currently not used and reserved for future usage. - :type user_assigned_identities: dict[str, ~azure.mgmt.eventgrid.models.UserIdentityProperties] + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] """ _attribute_map = { @@ -1285,6 +1641,23 @@ def __init__( self, **kwargs ): + """ + :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user-assigned identities. The type + 'None' will remove any identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned". + :paramtype type: str or ~azure.mgmt.eventgrid.models.IdentityType + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + This property is currently not used and reserved for future usage. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] + """ super(IdentityInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) @@ -1295,11 +1668,11 @@ def __init__( class InboundIpRule(msrest.serialization.Model): """InboundIpRule. - :param ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. - :type ip_mask: str - :param action: Action to perform based on the match or no match of the IpMask. Possible values + :ivar ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. + :vartype ip_mask: str + :ivar action: Action to perform based on the match or no match of the IpMask. Possible values include: "Allow". - :type action: str or ~azure.mgmt.eventgrid.models.IpActionType + :vartype action: str or ~azure.mgmt.eventgrid.models.IpActionType """ _attribute_map = { @@ -1311,6 +1684,13 @@ def __init__( self, **kwargs ): + """ + :keyword ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. + :paramtype ip_mask: str + :keyword action: Action to perform based on the match or no match of the IpMask. Possible + values include: "Allow". + :paramtype action: str or ~azure.mgmt.eventgrid.models.IpActionType + """ super(InboundIpRule, self).__init__(**kwargs) self.ip_mask = kwargs.get('ip_mask', None) self.action = kwargs.get('action', None) @@ -1324,9 +1704,9 @@ class InputSchemaMapping(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType """ _validation = { @@ -1345,16 +1725,92 @@ def __init__( self, **kwargs ): + """ + """ super(InputSchemaMapping, self).__init__(**kwargs) self.input_schema_mapping_type = None # type: Optional[str] +class IsNotNullAdvancedFilter(AdvancedFilter): + """IsNotNull Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + """ + super(IsNotNullAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'IsNotNull' # type: str + + +class IsNullOrUndefinedAdvancedFilter(AdvancedFilter): + """IsNullOrUndefined Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + """ + super(IsNullOrUndefinedAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'IsNullOrUndefined' # type: str + + class JsonField(msrest.serialization.Model): """This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the input event schema. - :param source_field: Name of a field in the input event schema that's to be used as the source + :ivar source_field: Name of a field in the input event schema that's to be used as the source of a mapping. - :type source_field: str + :vartype source_field: str """ _attribute_map = { @@ -1365,6 +1821,11 @@ def __init__( self, **kwargs ): + """ + :keyword source_field: Name of a field in the input event schema that's to be used as the + source of a mapping. + :paramtype source_field: str + """ super(JsonField, self).__init__(**kwargs) self.source_field = kwargs.get('source_field', None) @@ -1375,12 +1836,12 @@ class JsonFieldWithDefault(msrest.serialization.Model): 'eventtype' and 'dataversion' properties. This represents a field in the input event schema along with a default value to be used, and at least one of these two properties should be provided. - :param source_field: Name of a field in the input event schema that's to be used as the source + :ivar source_field: Name of a field in the input event schema that's to be used as the source of a mapping. - :type source_field: str - :param default_value: The default value to be used for mapping when a SourceField is not + :vartype source_field: str + :ivar default_value: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - :type default_value: str + :vartype default_value: str """ _attribute_map = { @@ -1392,6 +1853,14 @@ def __init__( self, **kwargs ): + """ + :keyword source_field: Name of a field in the input event schema that's to be used as the + source of a mapping. + :paramtype source_field: str + :keyword default_value: The default value to be used for mapping when a SourceField is not + provided or if there's no property with the specified name in the published JSON event payload. + :paramtype default_value: str + """ super(JsonFieldWithDefault, self).__init__(**kwargs) self.source_field = kwargs.get('source_field', None) self.default_value = kwargs.get('default_value', None) @@ -1402,22 +1871,22 @@ class JsonInputSchemaMapping(InputSchemaMapping): All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType - :param id: The mapping information for the Id property of the Event Grid Event. - :type id: ~azure.mgmt.eventgrid.models.JsonField - :param topic: The mapping information for the Topic property of the Event Grid Event. - :type topic: ~azure.mgmt.eventgrid.models.JsonField - :param event_time: The mapping information for the EventTime property of the Event Grid Event. - :type event_time: ~azure.mgmt.eventgrid.models.JsonField - :param event_type: The mapping information for the EventType property of the Event Grid Event. - :type event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param subject: The mapping information for the Subject property of the Event Grid Event. - :type subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param data_version: The mapping information for the DataVersion property of the Event Grid + :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :ivar id: The mapping information for the Id property of the Event Grid Event. + :vartype id: ~azure.mgmt.eventgrid.models.JsonField + :ivar topic: The mapping information for the Topic property of the Event Grid Event. + :vartype topic: ~azure.mgmt.eventgrid.models.JsonField + :ivar event_time: The mapping information for the EventTime property of the Event Grid Event. + :vartype event_time: ~azure.mgmt.eventgrid.models.JsonField + :ivar event_type: The mapping information for the EventType property of the Event Grid Event. + :vartype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :ivar subject: The mapping information for the Subject property of the Event Grid Event. + :vartype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :ivar data_version: The mapping information for the DataVersion property of the Event Grid Event. - :type data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :vartype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault """ _validation = { @@ -1438,6 +1907,23 @@ def __init__( self, **kwargs ): + """ + :keyword id: The mapping information for the Id property of the Event Grid Event. + :paramtype id: ~azure.mgmt.eventgrid.models.JsonField + :keyword topic: The mapping information for the Topic property of the Event Grid Event. + :paramtype topic: ~azure.mgmt.eventgrid.models.JsonField + :keyword event_time: The mapping information for the EventTime property of the Event Grid + Event. + :paramtype event_time: ~azure.mgmt.eventgrid.models.JsonField + :keyword event_type: The mapping information for the EventType property of the Event Grid + Event. + :paramtype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :keyword subject: The mapping information for the Subject property of the Event Grid Event. + :paramtype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :keyword data_version: The mapping information for the DataVersion property of the Event Grid + Event. + :paramtype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + """ super(JsonInputSchemaMapping, self).__init__(**kwargs) self.input_schema_mapping_type = 'Json' # type: str self.id = kwargs.get('id', None) @@ -1453,16 +1939,17 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1479,6 +1966,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberGreaterThanAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberGreaterThan' # type: str self.value = kwargs.get('value', None) @@ -1489,16 +1982,17 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1515,6 +2009,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberGreaterThanOrEqualsAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberGreaterThanOrEquals' # type: str self.value = kwargs.get('value', None) @@ -1525,16 +2025,17 @@ class NumberInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[float] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[float] """ _validation = { @@ -1551,26 +2052,76 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[float] + """ super(NumberInAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberIn' # type: str self.values = kwargs.get('values', None) +class NumberInRangeAdvancedFilter(AdvancedFilter): + """NumberInRange Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[list[float]] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[list[float]] + """ + super(NumberInRangeAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberInRange' # type: str + self.values = kwargs.get('values', None) + + class NumberLessThanAdvancedFilter(AdvancedFilter): """NumberLessThan Advanced Filter. All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1587,6 +2138,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberLessThanAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberLessThan' # type: str self.value = kwargs.get('value', None) @@ -1597,16 +2154,17 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1623,6 +2181,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberLessThanOrEqualsAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberLessThanOrEquals' # type: str self.value = kwargs.get('value', None) @@ -1633,16 +2197,17 @@ class NumberNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[float] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[float] """ _validation = { @@ -1659,22 +2224,71 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[float] + """ super(NumberNotInAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'NumberNotIn' # type: str self.values = kwargs.get('values', None) +class NumberNotInRangeAdvancedFilter(AdvancedFilter): + """NumberNotInRange Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[list[float]] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[list[float]] + """ + super(NumberNotInRangeAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'NumberNotInRange' # type: str + self.values = kwargs.get('values', None) + + class Operation(msrest.serialization.Model): """Represents an operation returned by the GetOperations request. - :param name: Name of the operation. - :type name: str - :param display: Display name of the operation. - :type display: ~azure.mgmt.eventgrid.models.OperationInfo - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: any + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Display name of the operation. + :vartype display: ~azure.mgmt.eventgrid.models.OperationInfo + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: any """ _attribute_map = { @@ -1688,6 +2302,16 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Display name of the operation. + :paramtype display: ~azure.mgmt.eventgrid.models.OperationInfo + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1698,14 +2322,14 @@ def __init__( class OperationInfo(msrest.serialization.Model): """Information about an operation. - :param provider: Name of the provider. - :type provider: str - :param resource: Name of the resource type. - :type resource: str - :param operation: Name of the operation. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Name of the provider. + :vartype provider: str + :ivar resource: Name of the resource type. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1719,6 +2343,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Name of the provider. + :paramtype provider: str + :keyword resource: Name of the resource type. + :paramtype resource: str + :keyword operation: Name of the operation. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationInfo, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1729,8 +2363,8 @@ def __init__( class OperationsListResult(msrest.serialization.Model): """Result of the List Operations operation. - :param value: A collection of operations. - :type value: list[~azure.mgmt.eventgrid.models.Operation] + :ivar value: A collection of operations. + :vartype value: list[~azure.mgmt.eventgrid.models.Operation] """ _attribute_map = { @@ -1741,6 +2375,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of operations. + :paramtype value: list[~azure.mgmt.eventgrid.models.Operation] + """ super(OperationsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -1748,8 +2386,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """PrivateEndpoint information. - :param id: The ARM identifier for Private Endpoint. - :type id: str + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ _attribute_map = { @@ -1760,6 +2398,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: The ARM identifier for Private Endpoint. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -1775,15 +2417,15 @@ class PrivateEndpointConnection(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 + :ivar private_endpoint: The Private Endpoint resource for this Connection. + :vartype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :ivar group_ids: GroupIds from the private link service resource. + :vartype group_ids: list[str] + :ivar private_link_service_connection_state: Details about the state of the connection. + :vartype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState """ _validation = { @@ -1806,6 +2448,17 @@ def __init__( self, **kwargs ): + """ + :keyword private_endpoint: The Private Endpoint resource for this Connection. + :paramtype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :keyword group_ids: GroupIds from the private link service resource. + :paramtype group_ids: list[str] + :keyword private_link_service_connection_state: Details about the state of the connection. + :paramtype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.group_ids = kwargs.get('group_ids', None) @@ -1816,10 +2469,10 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. - :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :param next_link: A link for the next page of private endpoint connection resources. - :type next_link: str + :ivar value: A collection of private endpoint connection resources. + :vartype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :ivar next_link: A link for the next page of private endpoint connection resources. + :vartype next_link: str """ _attribute_map = { @@ -1831,6 +2484,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of private endpoint connection resources. + :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :keyword next_link: A link for the next page of private endpoint connection resources. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1839,20 +2498,20 @@ def __init__( class PrivateLinkResource(msrest.serialization.Model): """Information of the private link resource. - :param id: Fully qualified identifier of the resource. - :type id: str - :param name: Name of the resource. - :type name: str - :param type: Type of the resource. - :type type: str - :param group_id: - :type group_id: str - :param display_name: - :type display_name: str - :param required_members: - :type required_members: list[str] - :param required_zone_names: - :type required_zone_names: list[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 + :ivar group_id: + :vartype group_id: str + :ivar display_name: + :vartype display_name: str + :ivar required_members: + :vartype required_members: list[str] + :ivar required_zone_names: + :vartype required_zone_names: list[str] """ _attribute_map = { @@ -1869,6 +2528,22 @@ def __init__( self, **kwargs ): + """ + :keyword id: Fully qualified identifier of the resource. + :paramtype id: str + :keyword name: Name of the resource. + :paramtype name: str + :keyword type: Type of the resource. + :paramtype type: str + :keyword group_id: + :paramtype group_id: str + :keyword display_name: + :paramtype display_name: str + :keyword required_members: + :paramtype required_members: list[str] + :keyword required_zone_names: + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -1882,10 +2557,10 @@ def __init__( class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. - :param value: A collection of private link resources. - :type value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] - :param next_link: A link for the next page of private link resources. - :type next_link: str + :ivar value: A collection of private link resources. + :vartype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :ivar next_link: A link for the next page of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -1897,6 +2572,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of private link resources. + :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :keyword next_link: A link for the next page of private link resources. + :paramtype next_link: str + """ super(PrivateLinkResourcesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1905,10 +2586,10 @@ def __init__( class RetryPolicy(msrest.serialization.Model): """Information about the retry policy for an event subscription. - :param max_delivery_attempts: Maximum number of delivery retry attempts for events. - :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 + :ivar max_delivery_attempts: Maximum number of delivery retry attempts for events. + :vartype max_delivery_attempts: int + :ivar event_time_to_live_in_minutes: Time To Live (in minutes) for events. + :vartype event_time_to_live_in_minutes: int """ _attribute_map = { @@ -1920,6 +2601,12 @@ def __init__( self, **kwargs ): + """ + :keyword max_delivery_attempts: Maximum number of delivery retry attempts for events. + :paramtype max_delivery_attempts: int + :keyword event_time_to_live_in_minutes: Time To Live (in minutes) for events. + :paramtype event_time_to_live_in_minutes: int + """ super(RetryPolicy, self).__init__(**kwargs) self.max_delivery_attempts = kwargs.get('max_delivery_attempts', 30) self.event_time_to_live_in_minutes = kwargs.get('event_time_to_live_in_minutes', 1440) @@ -1930,15 +2617,16 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -1955,6 +2643,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'ServiceBusQueue' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -1966,15 +2662,16 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -1991,6 +2688,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + Topic destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'ServiceBusTopic' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -2002,15 +2707,15 @@ class StaticDeliveryAttributeMapping(DeliveryAttributeMapping): All required parameters must be populated in order to send to Azure. - :param name: Name of the delivery attribute or header. - :type name: str - :param type: Required. Type of the delivery attribute or header name.Constant filled by server. + :ivar name: Name of the delivery attribute or header. + :vartype name: str + :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. Possible values include: "Static", "Dynamic". - :type type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :param value: Value of the delivery attribute. - :type value: str - :param is_secret: Boolean flag to tell if the attribute contains sensitive information . - :type is_secret: bool + :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType + :ivar value: Value of the delivery attribute. + :vartype value: str + :ivar is_secret: Boolean flag to tell if the attribute contains sensitive information . + :vartype is_secret: bool """ _validation = { @@ -2028,6 +2733,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the delivery attribute or header. + :paramtype name: str + :keyword value: Value of the delivery attribute. + :paramtype value: str + :keyword is_secret: Boolean flag to tell if the attribute contains sensitive information . + :paramtype is_secret: bool + """ super(StaticDeliveryAttributeMapping, self).__init__(**kwargs) self.type = 'Static' # type: str self.value = kwargs.get('value', None) @@ -2039,15 +2752,15 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant - filled by server. Possible values include: "StorageBlob". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType - :param resource_id: The Azure Resource ID of the storage account that is the destination of the + :ivar endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType + :ivar resource_id: The Azure Resource ID of the storage account that is the destination of the deadletter events. - :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is the destination of + :vartype resource_id: str + :ivar blob_container_name: The name of the Storage blob container that is the destination of the deadletter events. - :type blob_container_name: str + :vartype blob_container_name: str """ _validation = { @@ -2064,6 +2777,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of the storage account that is the destination of + the deadletter events. + :paramtype resource_id: str + :keyword blob_container_name: The name of the Storage blob container that is the destination of + the deadletter events. + :paramtype blob_container_name: str + """ super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) self.endpoint_type = 'StorageBlob' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -2075,18 +2796,18 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource ID of the storage account that contains the queue that - is the destination of an event subscription. - :type resource_id: str - :param queue_name: The name of the Storage queue under a storage account that is the - destination of an event subscription. - :type queue_name: str - :param queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. - :type queue_message_time_to_live_in_seconds: long + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource ID of the storage account that contains the queue that is + the destination of an event subscription. + :vartype resource_id: str + :ivar queue_name: The name of the Storage queue under a storage account that is the destination + of an event subscription. + :vartype queue_name: str + :ivar queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. + :vartype queue_message_time_to_live_in_seconds: long """ _validation = { @@ -2104,6 +2825,16 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of the storage account that contains the queue that + is the destination of an event subscription. + :paramtype resource_id: str + :keyword queue_name: The name of the Storage queue under a storage account that is the + destination of an event subscription. + :paramtype queue_name: str + :keyword queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. + :paramtype queue_message_time_to_live_in_seconds: long + """ super(StorageQueueEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'StorageQueue' # type: str self.resource_id = kwargs.get('resource_id', None) @@ -2116,16 +2847,17 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2142,6 +2874,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringBeginsWithAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'StringBeginsWith' # type: str self.values = kwargs.get('values', None) @@ -2152,16 +2890,17 @@ class StringContainsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2178,6 +2917,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringContainsAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'StringContains' # type: str self.values = kwargs.get('values', None) @@ -2188,16 +2933,17 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2214,6 +2960,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringEndsWithAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'StringEndsWith' # type: str self.values = kwargs.get('values', None) @@ -2224,16 +2976,17 @@ class StringInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2250,26 +3003,162 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringInAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'StringIn' # type: str self.values = kwargs.get('values', None) +class StringNotBeginsWithAdvancedFilter(AdvancedFilter): + """StringNotBeginsWith Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotBeginsWithAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringNotBeginsWith' # type: str + self.values = kwargs.get('values', None) + + +class StringNotContainsAdvancedFilter(AdvancedFilter): + """StringNotContains Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotContainsAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringNotContains' # type: str + self.values = kwargs.get('values', None) + + +class StringNotEndsWithAdvancedFilter(AdvancedFilter): + """StringNotEndsWith Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotEndsWithAdvancedFilter, self).__init__(**kwargs) + self.operator_type = 'StringNotEndsWith' # type: str + self.values = kwargs.get('values', None) + + class StringNotInAdvancedFilter(AdvancedFilter): """StringNotIn Advanced Filter. All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2286,6 +3175,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringNotInAdvancedFilter, self).__init__(**kwargs) self.operator_type = 'StringNotIn' # type: str self.values = kwargs.get('values', None) @@ -2294,20 +3189,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2323,6 +3218,22 @@ def __init__( self, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -2345,21 +3256,21 @@ class SystemTopic(TrackedResource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar system_data: The system metadata relating to System Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the system topic. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState - :param source: Source for the system topic. - :type source: str - :param topic_type: TopicType for the system topic. - :type topic_type: str + :ivar source: Source for the system topic. + :vartype source: str + :ivar topic_type: TopicType for the system topic. + :vartype topic_type: str :ivar metric_resource_id: Metric resource id for the system topic. :vartype metric_resource_id: str """ @@ -2392,6 +3303,18 @@ def __init__( self, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword source: Source for the system topic. + :paramtype source: str + :keyword topic_type: TopicType for the system topic. + :paramtype topic_type: str + """ super(SystemTopic, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) self.system_data = None @@ -2404,10 +3327,10 @@ def __init__( class SystemTopicsListResult(msrest.serialization.Model): """Result of the List System topics operation. - :param value: A collection of system Topics. - :type value: list[~azure.mgmt.eventgrid.models.SystemTopic] - :param next_link: A link for the next page of topics. - :type next_link: str + :ivar value: A collection of system Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.SystemTopic] + :ivar next_link: A link for the next page of topics. + :vartype next_link: str """ _attribute_map = { @@ -2419,6 +3342,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of system Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.SystemTopic] + :keyword next_link: A link for the next page of topics. + :paramtype next_link: str + """ super(SystemTopicsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2427,10 +3356,10 @@ def __init__( class SystemTopicUpdateParameters(msrest.serialization.Model): """Properties of the System Topic update. - :param tags: A set of tags. Tags of the system topic. - :type tags: dict[str, str] - :param identity: Resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar tags: A set of tags. Tags of the system topic. + :vartype tags: dict[str, str] + :ivar identity: Resource identity information. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _attribute_map = { @@ -2442,6 +3371,12 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the system topic. + :paramtype tags: dict[str, str] + :keyword identity: Resource identity information. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + """ super(SystemTopicUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.identity = kwargs.get('identity', None) @@ -2460,12 +3395,12 @@ class Topic(TrackedResource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar system_data: The system metadata relating to Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: @@ -2476,29 +3411,29 @@ class Topic(TrackedResource): :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicProvisioningState :ivar endpoint: Endpoint for the topic. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should expect for incoming + :ivar input_schema: This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", "CloudEventSchemaV1_0". - :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: This enables publishing using custom event schemas. An + :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :ivar input_schema_mapping: This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. - :type disable_local_auth: bool + :vartype disable_local_auth: bool """ _validation = { @@ -2536,6 +3471,35 @@ def __init__( self, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword input_schema: This determines the format that Event Grid should expect for incoming + events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", + "CloudEventSchemaV1_0". + :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :keyword input_schema_mapping: This enables publishing using custom event schemas. An + InputSchemaMapping can be specified to map various properties of a source schema to various + required properties of the EventGridEvent schema. + :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the topic. + :paramtype disable_local_auth: bool + """ super(Topic, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) self.system_data = None @@ -2555,8 +3519,8 @@ class TopicRegenerateKeyRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2. - :type key_name: str + :ivar key_name: Required. Key name to regenerate key1 or key2. + :vartype key_name: str """ _validation = { @@ -2571,6 +3535,10 @@ def __init__( self, **kwargs ): + """ + :keyword key_name: Required. Key name to regenerate key1 or key2. + :paramtype key_name: str + """ super(TopicRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = kwargs['key_name'] @@ -2578,10 +3546,10 @@ def __init__( class TopicSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Topic. - :param key1: Shared access key1 for the topic. - :type key1: str - :param key2: Shared access key2 for the topic. - :type key2: str + :ivar key1: Shared access key1 for the topic. + :vartype key1: str + :ivar key2: Shared access key2 for the topic. + :vartype key2: str """ _attribute_map = { @@ -2593,6 +3561,12 @@ def __init__( self, **kwargs ): + """ + :keyword key1: Shared access key1 for the topic. + :paramtype key1: str + :keyword key2: Shared access key2 for the topic. + :paramtype key2: str + """ super(TopicSharedAccessKeys, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -2601,10 +3575,10 @@ def __init__( class TopicsListResult(msrest.serialization.Model): """Result of the List Topics operation. - :param value: A collection of Topics. - :type value: list[~azure.mgmt.eventgrid.models.Topic] - :param next_link: A link for the next page of topics. - :type next_link: str + :ivar value: A collection of Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.Topic] + :ivar next_link: A link for the next page of topics. + :vartype next_link: str """ _attribute_map = { @@ -2616,6 +3590,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.Topic] + :keyword next_link: A link for the next page of topics. + :paramtype next_link: str + """ super(TopicsListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2632,24 +3612,24 @@ class TopicTypeInfo(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param provider: Namespace of the provider of the topic type. - :type provider: str - :param display_name: Display Name for the topic type. - :type display_name: str - :param description: Description of the topic type. - :type description: str - :param resource_region_type: Region type of the resource. Possible values include: + :ivar provider: Namespace of the provider of the topic type. + :vartype provider: str + :ivar display_name: Display Name for the topic type. + :vartype display_name: str + :ivar description: Description of the topic type. + :vartype description: str + :ivar resource_region_type: Region type of the resource. Possible values include: "RegionalResource", "GlobalResource". - :type resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType - :param provisioning_state: Provisioning state of the topic type. Possible values include: + :vartype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :ivar provisioning_state: Provisioning state of the topic type. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :param supported_locations: List of locations supported by this topic type. - :type supported_locations: list[str] - :param source_resource_format: Source resource format. - :type source_resource_format: str - :param supported_scopes_for_source: Supported source scopes. - :type supported_scopes_for_source: list[str or + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :ivar supported_locations: List of locations supported by this topic type. + :vartype supported_locations: list[str] + :ivar source_resource_format: Source resource format. + :vartype source_resource_format: str + :ivar supported_scopes_for_source: Supported source scopes. + :vartype supported_scopes_for_source: list[str or ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] """ @@ -2677,6 +3657,27 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Namespace of the provider of the topic type. + :paramtype provider: str + :keyword display_name: Display Name for the topic type. + :paramtype display_name: str + :keyword description: Description of the topic type. + :paramtype description: str + :keyword resource_region_type: Region type of the resource. Possible values include: + "RegionalResource", "GlobalResource". + :paramtype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :keyword provisioning_state: Provisioning state of the topic type. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :keyword supported_locations: List of locations supported by this topic type. + :paramtype supported_locations: list[str] + :keyword source_resource_format: Source resource format. + :paramtype source_resource_format: str + :keyword supported_scopes_for_source: Supported source scopes. + :paramtype supported_scopes_for_source: list[str or + ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] + """ super(TopicTypeInfo, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.display_name = kwargs.get('display_name', None) @@ -2691,8 +3692,8 @@ def __init__( class TopicTypesListResult(msrest.serialization.Model): """Result of the List Topic Types operation. - :param value: A collection of topic types. - :type value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + :ivar value: A collection of topic types. + :vartype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] """ _attribute_map = { @@ -2703,6 +3704,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: A collection of topic types. + :paramtype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + """ super(TopicTypesListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -2710,23 +3715,23 @@ def __init__( class TopicUpdateParameters(msrest.serialization.Model): """Properties of the Topic update. - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Topic resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Topic resource identity information. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. - :type disable_local_auth: bool + :vartype disable_local_auth: bool """ _attribute_map = { @@ -2741,6 +3746,25 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Topic resource identity information. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the topic. + :paramtype disable_local_auth: bool + """ super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.identity = kwargs.get('identity', None) @@ -2752,10 +3776,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.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 + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -2767,6 +3791,12 @@ def __init__( self, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = kwargs.get('principal_id', None) self.client_id = kwargs.get('client_id', None) @@ -2779,28 +3809,29 @@ class WebHookEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param endpoint_url: The URL that represents the endpoint of the destination of an event + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar endpoint_url: The URL that represents the endpoint of the destination of an event subscription. - :type endpoint_url: str + :vartype endpoint_url: str :ivar endpoint_base_url: The base URL that represents the endpoint of the destination of an event subscription. :vartype endpoint_base_url: str - :param max_events_per_batch: Maximum number of events per batch. - :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :type preferred_batch_size_in_kilobytes: int - :param azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access + :ivar max_events_per_batch: Maximum number of events per batch. + :vartype max_events_per_batch: int + :ivar preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :vartype preferred_batch_size_in_kilobytes: int + :ivar azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - :type azure_active_directory_tenant_id: str - :param azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID + :vartype azure_active_directory_tenant_id: str + :ivar azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. - :type azure_active_directory_application_id_or_uri: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype azure_active_directory_application_id_or_uri: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -2823,6 +3854,25 @@ def __init__( self, **kwargs ): + """ + :keyword endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. + :paramtype endpoint_url: str + :keyword max_events_per_batch: Maximum number of events per batch. + :paramtype max_events_per_batch: int + :keyword preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :paramtype preferred_batch_size_in_kilobytes: int + :keyword azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the + access token that will be included as the bearer token in delivery requests. + :paramtype azure_active_directory_tenant_id: str + :keyword azure_active_directory_application_id_or_uri: The Azure Active Directory Application + ID or URI to get the access token that will be included as the bearer token in delivery + requests. + :paramtype azure_active_directory_application_id_or_uri: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(WebHookEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'WebHook' # type: str self.endpoint_url = kwargs.get('endpoint_url', None) 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 e61e2efa585b..263fa736ff2b 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 @@ -18,18 +18,19 @@ class AdvancedFilter(msrest.serialization.Model): """This is the base type that represents an advanced filter. To configure an advanced filter, do not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key based on which you want to filter. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BoolEqualsAdvancedFilter, NumberGreaterThanAdvancedFilter, NumberGreaterThanOrEqualsAdvancedFilter, NumberInAdvancedFilter, NumberLessThanAdvancedFilter, NumberLessThanOrEqualsAdvancedFilter, NumberNotInAdvancedFilter, StringBeginsWithAdvancedFilter, StringContainsAdvancedFilter, StringEndsWithAdvancedFilter, StringInAdvancedFilter, StringNotInAdvancedFilter. + sub-classes are: BoolEqualsAdvancedFilter, IsNotNullAdvancedFilter, IsNullOrUndefinedAdvancedFilter, NumberGreaterThanAdvancedFilter, NumberGreaterThanOrEqualsAdvancedFilter, NumberInAdvancedFilter, NumberInRangeAdvancedFilter, NumberLessThanAdvancedFilter, NumberLessThanOrEqualsAdvancedFilter, NumberNotInAdvancedFilter, NumberNotInRangeAdvancedFilter, StringBeginsWithAdvancedFilter, StringContainsAdvancedFilter, StringEndsWithAdvancedFilter, StringInAdvancedFilter, StringNotBeginsWithAdvancedFilter, StringNotContainsAdvancedFilter, StringNotEndsWithAdvancedFilter, StringNotInAdvancedFilter. All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str """ _validation = { @@ -42,7 +43,7 @@ class AdvancedFilter(msrest.serialization.Model): } _subtype_map = { - 'operator_type': {'BoolEquals': 'BoolEqualsAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberIn': 'NumberInAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter'} + 'operator_type': {'BoolEquals': 'BoolEqualsAdvancedFilter', 'IsNotNull': 'IsNotNullAdvancedFilter', 'IsNullOrUndefined': 'IsNullOrUndefinedAdvancedFilter', 'NumberGreaterThan': 'NumberGreaterThanAdvancedFilter', 'NumberGreaterThanOrEquals': 'NumberGreaterThanOrEqualsAdvancedFilter', 'NumberIn': 'NumberInAdvancedFilter', 'NumberInRange': 'NumberInRangeAdvancedFilter', 'NumberLessThan': 'NumberLessThanAdvancedFilter', 'NumberLessThanOrEquals': 'NumberLessThanOrEqualsAdvancedFilter', 'NumberNotIn': 'NumberNotInAdvancedFilter', 'NumberNotInRange': 'NumberNotInRangeAdvancedFilter', 'StringBeginsWith': 'StringBeginsWithAdvancedFilter', 'StringContains': 'StringContainsAdvancedFilter', 'StringEndsWith': 'StringEndsWithAdvancedFilter', 'StringIn': 'StringInAdvancedFilter', 'StringNotBeginsWith': 'StringNotBeginsWithAdvancedFilter', 'StringNotContains': 'StringNotContainsAdvancedFilter', 'StringNotEndsWith': 'StringNotEndsWithAdvancedFilter', 'StringNotIn': 'StringNotInAdvancedFilter'} } def __init__( @@ -51,6 +52,10 @@ def __init__( key: Optional[str] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + """ super(AdvancedFilter, self).__init__(**kwargs) self.operator_type = None # type: Optional[str] self.key = key @@ -64,10 +69,10 @@ class EventSubscriptionDestination(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType """ _validation = { @@ -86,6 +91,8 @@ def __init__( self, **kwargs ): + """ + """ super(EventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = None # type: Optional[str] @@ -95,19 +102,20 @@ class AzureFunctionEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of the Azure Function + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. - :type resource_id: str - :param max_events_per_batch: Maximum number of events per batch. - :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :type preferred_batch_size_in_kilobytes: int - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar max_events_per_batch: Maximum number of events per batch. + :vartype max_events_per_batch: int + :ivar preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :vartype preferred_batch_size_in_kilobytes: int + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -131,6 +139,18 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of the Azure Function + destination of an event subscription. + :paramtype resource_id: str + :keyword max_events_per_batch: Maximum number of events per batch. + :paramtype max_events_per_batch: int + :keyword preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :paramtype preferred_batch_size_in_kilobytes: int + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(AzureFunctionEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'AzureFunction' # type: str self.resource_id = resource_id @@ -144,16 +164,17 @@ class BoolEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The boolean filter value. - :type value: bool + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The boolean filter value. + :vartype value: bool """ _validation = { @@ -173,6 +194,12 @@ def __init__( value: Optional[bool] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The boolean filter value. + :paramtype value: bool + """ super(BoolEqualsAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'BoolEquals' # type: str self.value = value @@ -181,13 +208,13 @@ def __init__( class ConnectionState(msrest.serialization.Model): """ConnectionState information. - :param status: Status of the connection. Possible values include: "Pending", "Approved", + :ivar 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 + :vartype status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :ivar description: Description of the connection state. + :vartype description: str + :ivar actions_required: Actions required (if any). + :vartype actions_required: str """ _attribute_map = { @@ -204,6 +231,15 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :paramtype status: str or ~azure.mgmt.eventgrid.models.PersistedConnectionStatus + :keyword description: Description of the connection state. + :paramtype description: str + :keyword actions_required: Actions required (if any). + :paramtype actions_required: str + """ super(ConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -218,9 +254,9 @@ class DeadLetterDestination(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant - filled by server. Possible values include: "StorageBlob". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType + :ivar endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType """ _validation = { @@ -239,6 +275,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeadLetterDestination, self).__init__(**kwargs) self.endpoint_type = None # type: Optional[str] @@ -246,13 +284,13 @@ def __init__( class DeadLetterWithResourceIdentity(msrest.serialization.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 + :ivar identity: The identity to use when dead-lettering events. + :vartype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :ivar dead_letter_destination: Information about the destination where events have to be delivered for the event subscription. Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination """ _attribute_map = { @@ -267,6 +305,15 @@ def __init__( dead_letter_destination: Optional["DeadLetterDestination"] = None, **kwargs ): + """ + :keyword identity: The identity to use when dead-lettering events. + :paramtype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :keyword dead_letter_destination: Information about the destination where events have to be + delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire + the authentication tokens being used during delivery / dead-lettering. + :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + """ super(DeadLetterWithResourceIdentity, self).__init__(**kwargs) self.identity = identity self.dead_letter_destination = dead_letter_destination @@ -275,8 +322,8 @@ def __init__( class DeliveryAttributeListResult(msrest.serialization.Model): """Result of the Get delivery attributes operation. - :param value: A collection of DeliveryAttributeMapping. - :type value: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :ivar value: A collection of DeliveryAttributeMapping. + :vartype value: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _attribute_map = { @@ -289,6 +336,10 @@ def __init__( value: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword value: A collection of DeliveryAttributeMapping. + :paramtype value: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(DeliveryAttributeListResult, self).__init__(**kwargs) self.value = value @@ -301,11 +352,11 @@ class DeliveryAttributeMapping(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Name of the delivery attribute or header. - :type name: str - :param type: Required. Type of the delivery attribute or header name.Constant filled by server. + :ivar name: Name of the delivery attribute or header. + :vartype name: str + :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. Possible values include: "Static", "Dynamic". - :type type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType + :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType """ _validation = { @@ -327,6 +378,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the delivery attribute or header. + :paramtype name: str + """ super(DeliveryAttributeMapping, self).__init__(**kwargs) self.name = name self.type = None # type: Optional[str] @@ -335,13 +390,13 @@ def __init__( class DeliveryWithResourceIdentity(msrest.serialization.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 + :ivar identity: The identity to use when delivering events. + :vartype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :ivar destination: Information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination """ _attribute_map = { @@ -356,6 +411,15 @@ def __init__( destination: Optional["EventSubscriptionDestination"] = None, **kwargs ): + """ + :keyword identity: The identity to use when delivering events. + :paramtype identity: ~azure.mgmt.eventgrid.models.EventSubscriptionIdentity + :keyword destination: Information about the destination where events have to be delivered for + the event subscription. + Uses Azure Event Grid's identity to acquire the authentication tokens being used during + delivery / dead-lettering. + :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + """ super(DeliveryWithResourceIdentity, self).__init__(**kwargs) self.identity = identity self.destination = destination @@ -390,6 +454,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -409,10 +475,10 @@ class TrackedResource(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: A set of tags. Tags of the resource. - :type tags: dict[str, str] + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -437,6 +503,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -455,14 +527,14 @@ class Domain(TrackedResource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to Domain resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :param identity: Identity information for the Event Grid Domain resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar identity: Identity information for the Event Grid Domain resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] @@ -471,29 +543,29 @@ class Domain(TrackedResource): :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.DomainProvisioningState :ivar endpoint: Endpoint for the domain. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should expect for incoming + :ivar input_schema: This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: "EventGridSchema", "CustomEventSchema", "CloudEventSchemaV1_0". - :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: Information about the InputSchemaMapping which specified the info + :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :ivar input_schema_mapping: Information about the InputSchemaMapping which specified the info about mapping event payload. - :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the domain. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. - :type disable_local_auth: bool - :param auto_create_topic_with_first_subscription: This Boolean is used to specify the creation + :vartype disable_local_auth: bool + :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, creation of domain topic can be auto-managed (when true) or self-managed @@ -507,8 +579,8 @@ class Domain(TrackedResource): flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the domain topic on demand if needed. - :type auto_create_topic_with_first_subscription: bool - :param auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + :vartype auto_create_topic_with_first_subscription: bool + :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, deletion of domain topic can be auto-managed (when true) or self-managed @@ -522,7 +594,7 @@ class Domain(TrackedResource): control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer resources by the user. - :type auto_delete_topic_with_last_subscription: bool + :vartype auto_delete_topic_with_last_subscription: bool """ _validation = { @@ -573,6 +645,64 @@ def __init__( auto_delete_topic_with_last_subscription: Optional[bool] = True, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the Event Grid Domain resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword input_schema: This determines the format that Event Grid should expect for incoming + events published to the domain. Possible values include: "EventGridSchema", + "CustomEventSchema", "CloudEventSchemaV1_0". + :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :keyword input_schema_mapping: Information about the InputSchemaMapping which specified the + info about mapping event payload. + :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the domain. + :paramtype disable_local_auth: bool + :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the + creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid + Domain resource. + In this context, creation of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is null or set to true, Event Grid is responsible of automatically creating + the domain topic when the first event subscription is + created at the scope of the domain topic. If this property is set to false, then creating the + first event subscription will require creating a domain topic + by the user. The self-management mode can be used if the user wants full control of when the + domain topic is created, while auto-managed mode provides the + flexibility to perform less operations and manage fewer resources by the user. Also, note that + in auto-managed creation mode, user is allowed to create the + domain topic on demand if needed. + :paramtype auto_create_topic_with_first_subscription: bool + :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain + resource. + In this context, deletion of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is set to true, Event Grid is responsible of automatically deleting the + domain topic when the last event subscription at the scope + of the domain topic is deleted. If this property is set to false, then the user needs to + manually delete the domain topic when it is no longer needed + (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The + self-management mode can be used if the user wants full + control of when the domain topic needs to be deleted, while auto-managed mode provides the + flexibility to perform less operations and manage fewer + resources by the user. + :paramtype auto_delete_topic_with_last_subscription: bool + """ super(Domain, self).__init__(location=location, tags=tags, **kwargs) self.system_data = None self.identity = identity @@ -594,8 +724,8 @@ class DomainRegenerateKeyRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2. - :type key_name: str + :ivar key_name: Required. Key name to regenerate key1 or key2. + :vartype key_name: str """ _validation = { @@ -612,6 +742,10 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. Key name to regenerate key1 or key2. + :paramtype key_name: str + """ super(DomainRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = key_name @@ -619,10 +753,10 @@ def __init__( class DomainSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Domain. - :param key1: Shared access key1 for the domain. - :type key1: str - :param key2: Shared access key2 for the domain. - :type key2: str + :ivar key1: Shared access key1 for the domain. + :vartype key1: str + :ivar key2: Shared access key2 for the domain. + :vartype key2: str """ _attribute_map = { @@ -637,6 +771,12 @@ def __init__( key2: Optional[str] = None, **kwargs ): + """ + :keyword key1: Shared access key1 for the domain. + :paramtype key1: str + :keyword key2: Shared access key2 for the domain. + :paramtype key2: str + """ super(DomainSharedAccessKeys, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -645,10 +785,10 @@ def __init__( class DomainsListResult(msrest.serialization.Model): """Result of the List Domains operation. - :param value: A collection of Domains. - :type value: list[~azure.mgmt.eventgrid.models.Domain] - :param next_link: A link for the next page of domains. - :type next_link: str + :ivar value: A collection of Domains. + :vartype value: list[~azure.mgmt.eventgrid.models.Domain] + :ivar next_link: A link for the next page of domains. + :vartype next_link: str """ _attribute_map = { @@ -663,6 +803,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Domains. + :paramtype value: list[~azure.mgmt.eventgrid.models.Domain] + :keyword next_link: A link for the next page of domains. + :paramtype next_link: str + """ super(DomainsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -706,6 +852,8 @@ def __init__( self, **kwargs ): + """ + """ super(DomainTopic, self).__init__(**kwargs) self.system_data = None self.provisioning_state = None @@ -714,10 +862,10 @@ def __init__( class DomainTopicsListResult(msrest.serialization.Model): """Result of the List Domain Topics operation. - :param value: A collection of Domain Topics. - :type value: list[~azure.mgmt.eventgrid.models.DomainTopic] - :param next_link: A link for the next page of domain topics. - :type next_link: str + :ivar value: A collection of Domain Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :ivar next_link: A link for the next page of domain topics. + :vartype next_link: str """ _attribute_map = { @@ -732,6 +880,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Domain Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.DomainTopic] + :keyword next_link: A link for the next page of domain topics. + :paramtype next_link: str + """ super(DomainTopicsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -740,24 +894,24 @@ def __init__( class DomainUpdateParameters(msrest.serialization.Model): """Properties of the Domain update. - :param tags: A set of tags. Tags of the domains resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar tags: A set of tags. Tags of the domains resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. - :type disable_local_auth: bool - :param auto_create_topic_with_first_subscription: This Boolean is used to specify the creation + :vartype disable_local_auth: bool + :ivar auto_create_topic_with_first_subscription: This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, creation of domain topic can be auto-managed (when true) or self-managed @@ -771,8 +925,8 @@ class DomainUpdateParameters(msrest.serialization.Model): flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the domain topic on demand if needed. - :type auto_create_topic_with_first_subscription: bool - :param auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + :vartype auto_create_topic_with_first_subscription: bool + :ivar auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. In this context, deletion of domain topic can be auto-managed (when true) or self-managed @@ -786,7 +940,7 @@ class DomainUpdateParameters(msrest.serialization.Model): control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer resources by the user. - :type auto_delete_topic_with_last_subscription: bool + :vartype auto_delete_topic_with_last_subscription: bool """ _attribute_map = { @@ -811,6 +965,55 @@ def __init__( auto_delete_topic_with_last_subscription: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the domains resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the domain. + :paramtype disable_local_auth: bool + :keyword auto_create_topic_with_first_subscription: This Boolean is used to specify the + creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid + Domain resource. + In this context, creation of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is null or set to true, Event Grid is responsible of automatically creating + the domain topic when the first event subscription is + created at the scope of the domain topic. If this property is set to false, then creating the + first event subscription will require creating a domain topic + by the user. The self-management mode can be used if the user wants full control of when the + domain topic is created, while auto-managed mode provides the + flexibility to perform less operations and manage fewer resources by the user. Also, note that + in auto-managed creation mode, user is allowed to create the + domain topic on demand if needed. + :paramtype auto_create_topic_with_first_subscription: bool + :keyword auto_delete_topic_with_last_subscription: This Boolean is used to specify the deletion + mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain + resource. + In this context, deletion of domain topic can be auto-managed (when true) or self-managed + (when false). The default value for this property is true. + When this property is set to true, Event Grid is responsible of automatically deleting the + domain topic when the last event subscription at the scope + of the domain topic is deleted. If this property is set to false, then the user needs to + manually delete the domain topic when it is no longer needed + (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The + self-management mode can be used if the user wants full + control of when the domain topic needs to be deleted, while auto-managed mode provides the + flexibility to perform less operations and manage fewer + resources by the user. + :paramtype auto_delete_topic_with_last_subscription: bool + """ super(DomainUpdateParameters, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -826,13 +1029,13 @@ class DynamicDeliveryAttributeMapping(DeliveryAttributeMapping): All required parameters must be populated in order to send to Azure. - :param name: Name of the delivery attribute or header. - :type name: str - :param type: Required. Type of the delivery attribute or header name.Constant filled by server. + :ivar name: Name of the delivery attribute or header. + :vartype name: str + :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. Possible values include: "Static", "Dynamic". - :type type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :param source_field: JSON path in the event which contains attribute value. - :type source_field: str + :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType + :ivar source_field: JSON path in the event which contains attribute value. + :vartype source_field: str """ _validation = { @@ -852,6 +1055,12 @@ def __init__( source_field: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the delivery attribute or header. + :paramtype name: str + :keyword source_field: JSON path in the event which contains attribute value. + :paramtype source_field: str + """ super(DynamicDeliveryAttributeMapping, self).__init__(name=name, **kwargs) self.type = 'Dynamic' # type: str self.source_field = source_field @@ -862,15 +1071,16 @@ class EventHubEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -890,6 +1100,14 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of an Event Hub + destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(EventHubEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'EventHub' # type: str self.resource_id = resource_id @@ -916,35 +1134,35 @@ class EventSubscription(Resource): "AwaitingManualAction". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.EventSubscriptionProvisioningState - :param destination: Information about the destination where events have to be delivered for the + :ivar destination: Information about the destination where events have to be delivered for the event subscription. - :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination where events have to + :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :ivar delivery_with_resource_identity: Information about the destination where events have to be delivered for the event subscription. Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type delivery_with_resource_identity: + :vartype 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. - :type labels: list[str] - :param expiration_time_utc: Expiration time of the event subscription. - :type expiration_time_utc: ~datetime.datetime - :param event_delivery_schema: The event delivery schema for the event subscription. Possible + :ivar filter: Information about the filter for the event subscription. + :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :ivar labels: List of user defined labels. + :vartype labels: list[str] + :ivar expiration_time_utc: Expiration time of the event subscription. + :vartype expiration_time_utc: ~datetime.datetime + :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to configure maximum number + :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :ivar retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event subscription. - :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of the event + :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :ivar dead_letter_destination: The DeadLetter destination of the event subscription. + :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :ivar dead_letter_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type dead_letter_with_resource_identity: + :vartype dead_letter_with_resource_identity: ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ @@ -989,6 +1207,38 @@ def __init__( dead_letter_with_resource_identity: Optional["DeadLetterWithResourceIdentity"] = None, **kwargs ): + """ + :keyword destination: Information about the destination where events have to be delivered for + the event subscription. + :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :keyword delivery_with_resource_identity: Information about the destination where events have + to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire + the authentication tokens being used during delivery / dead-lettering. + :paramtype delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :keyword filter: Information about the filter for the event subscription. + :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :keyword labels: List of user defined labels. + :paramtype labels: list[str] + :keyword expiration_time_utc: Expiration time of the event subscription. + :paramtype expiration_time_utc: ~datetime.datetime + :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :keyword retry_policy: The retry policy for events. This can be used to configure maximum + number of delivery attempts and time to live for events. + :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :keyword dead_letter_destination: The DeadLetter destination of the event subscription. + :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :keyword dead_letter_with_resource_identity: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is sent to the dead letter + destination. + Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire + the authentication tokens being used during delivery / dead-lettering. + :paramtype dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + """ super(EventSubscription, self).__init__(**kwargs) self.system_data = None self.topic = None @@ -1007,29 +1257,29 @@ def __init__( class EventSubscriptionFilter(msrest.serialization.Model): """Filter for the Event Subscription. - :param subject_begins_with: An optional string to filter events for an event subscription based + :ivar subject_begins_with: An optional string to filter events for an event subscription based on a resource path prefix. The format of this depends on the publisher of the events. Wildcard characters are not supported in this path. - :type subject_begins_with: str - :param subject_ends_with: An optional string to filter events for an event subscription based - on a resource path suffix. + :vartype subject_begins_with: str + :ivar subject_ends_with: An optional string to filter events for an event subscription based on + a resource path suffix. Wildcard characters are not supported in this path. - :type subject_ends_with: str - :param included_event_types: A list of applicable event types that need to be part of the event + :vartype subject_ends_with: str + :ivar included_event_types: A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - :type included_event_types: list[str] - :param is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + :vartype included_event_types: list[str] + :ivar is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter should be compared in a case sensitive manner. - :type is_subject_case_sensitive: bool - :param enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against an + :vartype is_subject_case_sensitive: bool + :ivar enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. - :type enable_advanced_filtering_on_arrays: bool - :param advanced_filters: An array of advanced filters that are used for filtering event + :vartype enable_advanced_filtering_on_arrays: bool + :ivar advanced_filters: An array of advanced filters that are used for filtering event subscriptions. - :type advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + :vartype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] """ _attribute_map = { @@ -1052,6 +1302,31 @@ def __init__( advanced_filters: Optional[List["AdvancedFilter"]] = None, **kwargs ): + """ + :keyword subject_begins_with: An optional string to filter events for an event subscription + based on a resource path prefix. + The format of this depends on the publisher of the events. + Wildcard characters are not supported in this path. + :paramtype subject_begins_with: str + :keyword subject_ends_with: An optional string to filter events for an event subscription based + on a resource path suffix. + Wildcard characters are not supported in this path. + :paramtype subject_ends_with: str + :keyword included_event_types: A list of applicable event types that need to be part of the + event subscription. If it is desired to subscribe to all default event types, set the + IncludedEventTypes to null. + :paramtype included_event_types: list[str] + :keyword is_subject_case_sensitive: Specifies if the SubjectBeginsWith and SubjectEndsWith + properties of the filter + should be compared in a case sensitive manner. + :paramtype is_subject_case_sensitive: bool + :keyword enable_advanced_filtering_on_arrays: Allows advanced filters to be evaluated against + an array of values instead of expecting a singular value. + :paramtype enable_advanced_filtering_on_arrays: bool + :keyword advanced_filters: An array of advanced filters that are used for filtering event + subscriptions. + :paramtype advanced_filters: list[~azure.mgmt.eventgrid.models.AdvancedFilter] + """ super(EventSubscriptionFilter, self).__init__(**kwargs) self.subject_begins_with = subject_begins_with self.subject_ends_with = subject_ends_with @@ -1064,9 +1339,9 @@ def __init__( class EventSubscriptionFullUrl(msrest.serialization.Model): """Full endpoint url of an event subscription. - :param endpoint_url: The URL that represents the endpoint of the destination of an event + :ivar endpoint_url: The URL that represents the endpoint of the destination of an event subscription. - :type endpoint_url: str + :vartype endpoint_url: str """ _attribute_map = { @@ -1079,6 +1354,11 @@ def __init__( endpoint_url: Optional[str] = None, **kwargs ): + """ + :keyword endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. + :paramtype endpoint_url: str + """ super(EventSubscriptionFullUrl, self).__init__(**kwargs) self.endpoint_url = endpoint_url @@ -1086,12 +1366,12 @@ def __init__( class EventSubscriptionIdentity(msrest.serialization.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 + :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user-assigned identities. The type 'None' will + remove any identity. Possible values include: "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :ivar user_assigned_identity: The user identity associated with the resource. + :vartype user_assigned_identity: str """ _attribute_map = { @@ -1106,6 +1386,14 @@ def __init__( user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user-assigned identities. The type + 'None' will remove any identity. Possible values include: "SystemAssigned", "UserAssigned". + :paramtype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType + :keyword user_assigned_identity: The user identity associated with the resource. + :paramtype user_assigned_identity: str + """ super(EventSubscriptionIdentity, self).__init__(**kwargs) self.type = type self.user_assigned_identity = user_assigned_identity @@ -1114,10 +1402,10 @@ def __init__( class EventSubscriptionsListResult(msrest.serialization.Model): """Result of the List EventSubscriptions operation. - :param value: A collection of EventSubscriptions. - :type value: list[~azure.mgmt.eventgrid.models.EventSubscription] - :param next_link: A link for the next page of event subscriptions. - :type next_link: str + :ivar value: A collection of EventSubscriptions. + :vartype value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :ivar next_link: A link for the next page of event subscriptions. + :vartype next_link: str """ _attribute_map = { @@ -1132,6 +1420,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of EventSubscriptions. + :paramtype value: list[~azure.mgmt.eventgrid.models.EventSubscription] + :keyword next_link: A link for the next page of event subscriptions. + :paramtype next_link: str + """ super(EventSubscriptionsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1140,35 +1434,35 @@ def __init__( class EventSubscriptionUpdateParameters(msrest.serialization.Model): """Properties of the Event Subscription update. - :param destination: Information about the destination where events have to be delivered for the + :ivar destination: Information about the destination where events have to be delivered for the event subscription. - :type destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination - :param delivery_with_resource_identity: Information about the destination where events have to + :vartype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :ivar delivery_with_resource_identity: Information about the destination where events have to be delivered for the event subscription. Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type delivery_with_resource_identity: + :vartype 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. - :type labels: list[str] - :param expiration_time_utc: Information about the expiration time for the event subscription. - :type expiration_time_utc: ~datetime.datetime - :param event_delivery_schema: The event delivery schema for the event subscription. Possible + :ivar filter: Information about the filter for the event subscription. + :vartype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :ivar labels: List of user defined labels. + :vartype labels: list[str] + :ivar expiration_time_utc: Information about the expiration time for the event subscription. + :vartype expiration_time_utc: ~datetime.datetime + :ivar event_delivery_schema: The event delivery schema for the event subscription. Possible values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". - :type event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema - :param retry_policy: The retry policy for events. This can be used to configure maximum number + :vartype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :ivar retry_policy: The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - :type retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy - :param dead_letter_destination: The DeadLetter destination of the event subscription. - :type dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination - :param dead_letter_with_resource_identity: The dead letter destination of the event + :vartype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :ivar dead_letter_destination: The DeadLetter destination of the event subscription. + :vartype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :ivar dead_letter_with_resource_identity: The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - :type dead_letter_with_resource_identity: + :vartype dead_letter_with_resource_identity: ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity """ @@ -1198,6 +1492,38 @@ def __init__( dead_letter_with_resource_identity: Optional["DeadLetterWithResourceIdentity"] = None, **kwargs ): + """ + :keyword destination: Information about the destination where events have to be delivered for + the event subscription. + :paramtype destination: ~azure.mgmt.eventgrid.models.EventSubscriptionDestination + :keyword delivery_with_resource_identity: Information about the destination where events have + to be delivered for the event subscription. + Uses the managed identity setup on the parent resource (topic / domain) to acquire the + authentication tokens being used during delivery / dead-lettering. + :paramtype delivery_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeliveryWithResourceIdentity + :keyword filter: Information about the filter for the event subscription. + :paramtype filter: ~azure.mgmt.eventgrid.models.EventSubscriptionFilter + :keyword labels: List of user defined labels. + :paramtype labels: list[str] + :keyword expiration_time_utc: Information about the expiration time for the event subscription. + :paramtype expiration_time_utc: ~datetime.datetime + :keyword event_delivery_schema: The event delivery schema for the event subscription. Possible + values include: "EventGridSchema", "CustomInputSchema", "CloudEventSchemaV1_0". + :paramtype event_delivery_schema: str or ~azure.mgmt.eventgrid.models.EventDeliverySchema + :keyword retry_policy: The retry policy for events. This can be used to configure maximum + number of delivery attempts and time to live for events. + :paramtype retry_policy: ~azure.mgmt.eventgrid.models.RetryPolicy + :keyword dead_letter_destination: The DeadLetter destination of the event subscription. + :paramtype dead_letter_destination: ~azure.mgmt.eventgrid.models.DeadLetterDestination + :keyword dead_letter_with_resource_identity: The dead letter destination of the event + subscription. Any event that cannot be delivered to its' destination is sent to the dead letter + destination. + Uses the managed identity setup on the parent resource (topic / domain) to acquire the + authentication tokens being used during delivery / dead-lettering. + :paramtype dead_letter_with_resource_identity: + ~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity + """ super(EventSubscriptionUpdateParameters, self).__init__(**kwargs) self.destination = destination self.delivery_with_resource_identity = delivery_with_resource_identity @@ -1221,14 +1547,14 @@ class EventType(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param display_name: Display name of the event type. - :type display_name: str - :param description: Description of the event type. - :type description: str - :param schema_url: Url of the schema for this event type. - :type schema_url: str - :param is_in_default_set: IsInDefaultSet flag of the event type. - :type is_in_default_set: bool + :ivar display_name: Display name of the event type. + :vartype display_name: str + :ivar description: Description of the event type. + :vartype description: str + :ivar schema_url: Url of the schema for this event type. + :vartype schema_url: str + :ivar is_in_default_set: IsInDefaultSet flag of the event type. + :vartype is_in_default_set: bool """ _validation = { @@ -1256,6 +1582,16 @@ def __init__( is_in_default_set: Optional[bool] = None, **kwargs ): + """ + :keyword display_name: Display name of the event type. + :paramtype display_name: str + :keyword description: Description of the event type. + :paramtype description: str + :keyword schema_url: Url of the schema for this event type. + :paramtype schema_url: str + :keyword is_in_default_set: IsInDefaultSet flag of the event type. + :paramtype is_in_default_set: bool + """ super(EventType, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -1266,8 +1602,8 @@ def __init__( class EventTypesListResult(msrest.serialization.Model): """Result of the List Event Types operation. - :param value: A collection of event types. - :type value: list[~azure.mgmt.eventgrid.models.EventType] + :ivar value: A collection of event types. + :vartype value: list[~azure.mgmt.eventgrid.models.EventType] """ _attribute_map = { @@ -1280,6 +1616,10 @@ def __init__( value: Optional[List["EventType"]] = None, **kwargs ): + """ + :keyword value: A collection of event types. + :paramtype value: list[~azure.mgmt.eventgrid.models.EventType] + """ super(EventTypesListResult, self).__init__(**kwargs) self.value = value @@ -1297,10 +1637,10 @@ class ExtensionTopic(Resource): :vartype type: str :ivar system_data: The system metadata relating to the Extension Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData - :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 + :ivar description: Description of the extension topic. + :vartype description: str + :ivar system_topic: System topic resource id which is mapped to the source. + :vartype system_topic: str """ _validation = { @@ -1326,6 +1666,12 @@ def __init__( system_topic: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the extension topic. + :paramtype description: str + :keyword system_topic: System topic resource id which is mapped to the source. + :paramtype system_topic: str + """ super(ExtensionTopic, self).__init__(**kwargs) self.system_data = None self.description = description @@ -1337,15 +1683,16 @@ class HybridConnectionEventSubscriptionDestination(EventSubscriptionDestination) All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource ID of an hybrid connection that is the destination of an + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -1365,6 +1712,14 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of an hybrid connection that is the destination of + an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(HybridConnectionEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'HybridConnection' # type: str self.resource_id = resource_id @@ -1374,20 +1729,21 @@ def __init__( class IdentityInfo(msrest.serialization.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 + :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user-assigned identities. The type 'None' will + remove any identity. Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.eventgrid.models.IdentityType + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. This property is currently not used and reserved for future usage. - :type user_assigned_identities: dict[str, ~azure.mgmt.eventgrid.models.UserIdentityProperties] + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] """ _attribute_map = { @@ -1406,6 +1762,23 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user-assigned identities. The type + 'None' will remove any identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned". + :paramtype type: str or ~azure.mgmt.eventgrid.models.IdentityType + :keyword principal_id: The principal ID of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant ID of resource. + :paramtype tenant_id: str + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + This property is currently not used and reserved for future usage. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.eventgrid.models.UserIdentityProperties] + """ super(IdentityInfo, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1416,11 +1789,11 @@ def __init__( class InboundIpRule(msrest.serialization.Model): """InboundIpRule. - :param ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. - :type ip_mask: str - :param action: Action to perform based on the match or no match of the IpMask. Possible values + :ivar ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. + :vartype ip_mask: str + :ivar action: Action to perform based on the match or no match of the IpMask. Possible values include: "Allow". - :type action: str or ~azure.mgmt.eventgrid.models.IpActionType + :vartype action: str or ~azure.mgmt.eventgrid.models.IpActionType """ _attribute_map = { @@ -1435,6 +1808,13 @@ def __init__( action: Optional[Union[str, "IpActionType"]] = None, **kwargs ): + """ + :keyword ip_mask: IP Address in CIDR notation e.g., 10.0.0.0/8. + :paramtype ip_mask: str + :keyword action: Action to perform based on the match or no match of the IpMask. Possible + values include: "Allow". + :paramtype action: str or ~azure.mgmt.eventgrid.models.IpActionType + """ super(InboundIpRule, self).__init__(**kwargs) self.ip_mask = ip_mask self.action = action @@ -1448,9 +1828,9 @@ class InputSchemaMapping(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType """ _validation = { @@ -1469,16 +1849,96 @@ def __init__( self, **kwargs ): + """ + """ super(InputSchemaMapping, self).__init__(**kwargs) self.input_schema_mapping_type = None # type: Optional[str] +class IsNotNullAdvancedFilter(AdvancedFilter): + """IsNotNull Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + """ + super(IsNotNullAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'IsNotNull' # type: str + + +class IsNullOrUndefinedAdvancedFilter(AdvancedFilter): + """IsNullOrUndefined Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + """ + super(IsNullOrUndefinedAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'IsNullOrUndefined' # type: str + + class JsonField(msrest.serialization.Model): """This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' properties. This represents a field in the input event schema. - :param source_field: Name of a field in the input event schema that's to be used as the source + :ivar source_field: Name of a field in the input event schema that's to be used as the source of a mapping. - :type source_field: str + :vartype source_field: str """ _attribute_map = { @@ -1491,6 +1951,11 @@ def __init__( source_field: Optional[str] = None, **kwargs ): + """ + :keyword source_field: Name of a field in the input event schema that's to be used as the + source of a mapping. + :paramtype source_field: str + """ super(JsonField, self).__init__(**kwargs) self.source_field = source_field @@ -1501,12 +1966,12 @@ class JsonFieldWithDefault(msrest.serialization.Model): 'eventtype' and 'dataversion' properties. This represents a field in the input event schema along with a default value to be used, and at least one of these two properties should be provided. - :param source_field: Name of a field in the input event schema that's to be used as the source + :ivar source_field: Name of a field in the input event schema that's to be used as the source of a mapping. - :type source_field: str - :param default_value: The default value to be used for mapping when a SourceField is not + :vartype source_field: str + :ivar default_value: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - :type default_value: str + :vartype default_value: str """ _attribute_map = { @@ -1521,6 +1986,14 @@ def __init__( default_value: Optional[str] = None, **kwargs ): + """ + :keyword source_field: Name of a field in the input event schema that's to be used as the + source of a mapping. + :paramtype source_field: str + :keyword default_value: The default value to be used for mapping when a SourceField is not + provided or if there's no property with the specified name in the published JSON event payload. + :paramtype default_value: str + """ super(JsonFieldWithDefault, self).__init__(**kwargs) self.source_field = source_field self.default_value = default_value @@ -1531,22 +2004,22 @@ class JsonInputSchemaMapping(InputSchemaMapping): All required parameters must be populated in order to send to Azure. - :param input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by - server. Possible values include: "Json". - :type input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType - :param id: The mapping information for the Id property of the Event Grid Event. - :type id: ~azure.mgmt.eventgrid.models.JsonField - :param topic: The mapping information for the Topic property of the Event Grid Event. - :type topic: ~azure.mgmt.eventgrid.models.JsonField - :param event_time: The mapping information for the EventTime property of the Event Grid Event. - :type event_time: ~azure.mgmt.eventgrid.models.JsonField - :param event_type: The mapping information for the EventType property of the Event Grid Event. - :type event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param subject: The mapping information for the Subject property of the Event Grid Event. - :type subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault - :param data_version: The mapping information for the DataVersion property of the Event Grid + :ivar input_schema_mapping_type: Required. Type of the custom mapping.Constant filled by + server. Possible values include: "Json". + :vartype input_schema_mapping_type: str or ~azure.mgmt.eventgrid.models.InputSchemaMappingType + :ivar id: The mapping information for the Id property of the Event Grid Event. + :vartype id: ~azure.mgmt.eventgrid.models.JsonField + :ivar topic: The mapping information for the Topic property of the Event Grid Event. + :vartype topic: ~azure.mgmt.eventgrid.models.JsonField + :ivar event_time: The mapping information for the EventTime property of the Event Grid Event. + :vartype event_time: ~azure.mgmt.eventgrid.models.JsonField + :ivar event_type: The mapping information for the EventType property of the Event Grid Event. + :vartype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :ivar subject: The mapping information for the Subject property of the Event Grid Event. + :vartype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :ivar data_version: The mapping information for the DataVersion property of the Event Grid Event. - :type data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :vartype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault """ _validation = { @@ -1574,6 +2047,23 @@ def __init__( data_version: Optional["JsonFieldWithDefault"] = None, **kwargs ): + """ + :keyword id: The mapping information for the Id property of the Event Grid Event. + :paramtype id: ~azure.mgmt.eventgrid.models.JsonField + :keyword topic: The mapping information for the Topic property of the Event Grid Event. + :paramtype topic: ~azure.mgmt.eventgrid.models.JsonField + :keyword event_time: The mapping information for the EventTime property of the Event Grid + Event. + :paramtype event_time: ~azure.mgmt.eventgrid.models.JsonField + :keyword event_type: The mapping information for the EventType property of the Event Grid + Event. + :paramtype event_type: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :keyword subject: The mapping information for the Subject property of the Event Grid Event. + :paramtype subject: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + :keyword data_version: The mapping information for the DataVersion property of the Event Grid + Event. + :paramtype data_version: ~azure.mgmt.eventgrid.models.JsonFieldWithDefault + """ super(JsonInputSchemaMapping, self).__init__(**kwargs) self.input_schema_mapping_type = 'Json' # type: str self.id = id @@ -1589,16 +2079,17 @@ class NumberGreaterThanAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1618,6 +2109,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberGreaterThanAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberGreaterThan' # type: str self.value = value @@ -1628,16 +2125,17 @@ class NumberGreaterThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1657,6 +2155,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberGreaterThanOrEqualsAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberGreaterThanOrEquals' # type: str self.value = value @@ -1667,16 +2171,17 @@ class NumberInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[float] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[float] """ _validation = { @@ -1696,26 +2201,79 @@ def __init__( values: Optional[List[float]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[float] + """ super(NumberInAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberIn' # type: str self.values = values +class NumberInRangeAdvancedFilter(AdvancedFilter): + """NumberInRange Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[list[float]] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[List[float]]] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[list[float]] + """ + super(NumberInRangeAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberInRange' # type: str + self.values = values + + class NumberLessThanAdvancedFilter(AdvancedFilter): """NumberLessThan Advanced Filter. All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1735,6 +2293,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberLessThanAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberLessThan' # type: str self.value = value @@ -1745,16 +2309,17 @@ class NumberLessThanOrEqualsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param value: The filter value. - :type value: float + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar value: The filter value. + :vartype value: float """ _validation = { @@ -1774,6 +2339,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword value: The filter value. + :paramtype value: float + """ super(NumberLessThanOrEqualsAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberLessThanOrEquals' # type: str self.value = value @@ -1784,16 +2355,17 @@ class NumberNotInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[float] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[float] """ _validation = { @@ -1813,22 +2385,74 @@ def __init__( values: Optional[List[float]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[float] + """ super(NumberNotInAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'NumberNotIn' # type: str self.values = values +class NumberNotInRangeAdvancedFilter(AdvancedFilter): + """NumberNotInRange Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[list[float]] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[List[float]]] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[list[float]] + """ + super(NumberNotInRangeAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'NumberNotInRange' # type: str + self.values = values + + class Operation(msrest.serialization.Model): """Represents an operation returned by the GetOperations request. - :param name: Name of the operation. - :type name: str - :param display: Display name of the operation. - :type display: ~azure.mgmt.eventgrid.models.OperationInfo - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: any + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Display name of the operation. + :vartype display: ~azure.mgmt.eventgrid.models.OperationInfo + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: any """ _attribute_map = { @@ -1847,6 +2471,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Display name of the operation. + :paramtype display: ~azure.mgmt.eventgrid.models.OperationInfo + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1857,14 +2491,14 @@ def __init__( class OperationInfo(msrest.serialization.Model): """Information about an operation. - :param provider: Name of the provider. - :type provider: str - :param resource: Name of the resource type. - :type resource: str - :param operation: Name of the operation. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Name of the provider. + :vartype provider: str + :ivar resource: Name of the resource type. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -1883,6 +2517,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Name of the provider. + :paramtype provider: str + :keyword resource: Name of the resource type. + :paramtype resource: str + :keyword operation: Name of the operation. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationInfo, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1893,8 +2537,8 @@ def __init__( class OperationsListResult(msrest.serialization.Model): """Result of the List Operations operation. - :param value: A collection of operations. - :type value: list[~azure.mgmt.eventgrid.models.Operation] + :ivar value: A collection of operations. + :vartype value: list[~azure.mgmt.eventgrid.models.Operation] """ _attribute_map = { @@ -1907,6 +2551,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: A collection of operations. + :paramtype value: list[~azure.mgmt.eventgrid.models.Operation] + """ super(OperationsListResult, self).__init__(**kwargs) self.value = value @@ -1914,8 +2562,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """PrivateEndpoint information. - :param id: The ARM identifier for Private Endpoint. - :type id: str + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ _attribute_map = { @@ -1928,6 +2576,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM identifier for Private Endpoint. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -1943,15 +2595,15 @@ class PrivateEndpointConnection(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 + :ivar private_endpoint: The Private Endpoint resource for this Connection. + :vartype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :ivar group_ids: GroupIds from the private link service resource. + :vartype group_ids: list[str] + :ivar private_link_service_connection_state: Details about the state of the connection. + :vartype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState """ _validation = { @@ -1979,6 +2631,17 @@ def __init__( provisioning_state: Optional[Union[str, "ResourceProvisioningState"]] = None, **kwargs ): + """ + :keyword private_endpoint: The Private Endpoint resource for this Connection. + :paramtype private_endpoint: ~azure.mgmt.eventgrid.models.PrivateEndpoint + :keyword group_ids: GroupIds from the private link service resource. + :paramtype group_ids: list[str] + :keyword private_link_service_connection_state: Details about the state of the connection. + :paramtype private_link_service_connection_state: ~azure.mgmt.eventgrid.models.ConnectionState + :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.group_ids = group_ids @@ -1989,10 +2652,10 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. - :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :param next_link: A link for the next page of private endpoint connection resources. - :type next_link: str + :ivar value: A collection of private endpoint connection resources. + :vartype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :ivar next_link: A link for the next page of private endpoint connection resources. + :vartype next_link: str """ _attribute_map = { @@ -2007,6 +2670,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of private endpoint connection resources. + :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] + :keyword next_link: A link for the next page of private endpoint connection resources. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2015,20 +2684,20 @@ def __init__( class PrivateLinkResource(msrest.serialization.Model): """Information of the private link resource. - :param id: Fully qualified identifier of the resource. - :type id: str - :param name: Name of the resource. - :type name: str - :param type: Type of the resource. - :type type: str - :param group_id: - :type group_id: str - :param display_name: - :type display_name: str - :param required_members: - :type required_members: list[str] - :param required_zone_names: - :type required_zone_names: list[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 + :ivar group_id: + :vartype group_id: str + :ivar display_name: + :vartype display_name: str + :ivar required_members: + :vartype required_members: list[str] + :ivar required_zone_names: + :vartype required_zone_names: list[str] """ _attribute_map = { @@ -2053,6 +2722,22 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword id: Fully qualified identifier of the resource. + :paramtype id: str + :keyword name: Name of the resource. + :paramtype name: str + :keyword type: Type of the resource. + :paramtype type: str + :keyword group_id: + :paramtype group_id: str + :keyword display_name: + :paramtype display_name: str + :keyword required_members: + :paramtype required_members: list[str] + :keyword required_zone_names: + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = id self.name = name @@ -2066,10 +2751,10 @@ def __init__( class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. - :param value: A collection of private link resources. - :type value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] - :param next_link: A link for the next page of private link resources. - :type next_link: str + :ivar value: A collection of private link resources. + :vartype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :ivar next_link: A link for the next page of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -2084,6 +2769,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of private link resources. + :paramtype value: list[~azure.mgmt.eventgrid.models.PrivateLinkResource] + :keyword next_link: A link for the next page of private link resources. + :paramtype next_link: str + """ super(PrivateLinkResourcesListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2092,10 +2783,10 @@ def __init__( class RetryPolicy(msrest.serialization.Model): """Information about the retry policy for an event subscription. - :param max_delivery_attempts: Maximum number of delivery retry attempts for events. - :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 + :ivar max_delivery_attempts: Maximum number of delivery retry attempts for events. + :vartype max_delivery_attempts: int + :ivar event_time_to_live_in_minutes: Time To Live (in minutes) for events. + :vartype event_time_to_live_in_minutes: int """ _attribute_map = { @@ -2110,6 +2801,12 @@ def __init__( event_time_to_live_in_minutes: Optional[int] = 1440, **kwargs ): + """ + :keyword max_delivery_attempts: Maximum number of delivery retry attempts for events. + :paramtype max_delivery_attempts: int + :keyword event_time_to_live_in_minutes: Time To Live (in minutes) for events. + :paramtype event_time_to_live_in_minutes: int + """ super(RetryPolicy, self).__init__(**kwargs) self.max_delivery_attempts = max_delivery_attempts self.event_time_to_live_in_minutes = event_time_to_live_in_minutes @@ -2120,15 +2817,16 @@ class ServiceBusQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -2148,6 +2846,14 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(ServiceBusQueueEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'ServiceBusQueue' # type: str self.resource_id = resource_id @@ -2159,15 +2865,16 @@ class ServiceBusTopicEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. - :type resource_id: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype resource_id: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -2187,6 +2894,14 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource Id that represents the endpoint of the Service Bus + Topic destination of an event subscription. + :paramtype resource_id: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(ServiceBusTopicEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'ServiceBusTopic' # type: str self.resource_id = resource_id @@ -2198,15 +2913,15 @@ class StaticDeliveryAttributeMapping(DeliveryAttributeMapping): All required parameters must be populated in order to send to Azure. - :param name: Name of the delivery attribute or header. - :type name: str - :param type: Required. Type of the delivery attribute or header name.Constant filled by server. + :ivar name: Name of the delivery attribute or header. + :vartype name: str + :ivar type: Required. Type of the delivery attribute or header name.Constant filled by server. Possible values include: "Static", "Dynamic". - :type type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType - :param value: Value of the delivery attribute. - :type value: str - :param is_secret: Boolean flag to tell if the attribute contains sensitive information . - :type is_secret: bool + :vartype type: str or ~azure.mgmt.eventgrid.models.DeliveryAttributeMappingType + :ivar value: Value of the delivery attribute. + :vartype value: str + :ivar is_secret: Boolean flag to tell if the attribute contains sensitive information . + :vartype is_secret: bool """ _validation = { @@ -2228,6 +2943,14 @@ def __init__( is_secret: Optional[bool] = False, **kwargs ): + """ + :keyword name: Name of the delivery attribute or header. + :paramtype name: str + :keyword value: Value of the delivery attribute. + :paramtype value: str + :keyword is_secret: Boolean flag to tell if the attribute contains sensitive information . + :paramtype is_secret: bool + """ super(StaticDeliveryAttributeMapping, self).__init__(name=name, **kwargs) self.type = 'Static' # type: str self.value = value @@ -2239,15 +2962,15 @@ class StorageBlobDeadLetterDestination(DeadLetterDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant - filled by server. Possible values include: "StorageBlob". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType - :param resource_id: The Azure Resource ID of the storage account that is the destination of the + :ivar endpoint_type: Required. Type of the endpoint for the dead letter destination.Constant + filled by server. Possible values include: "StorageBlob". + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.DeadLetterEndPointType + :ivar resource_id: The Azure Resource ID of the storage account that is the destination of the deadletter events. - :type resource_id: str - :param blob_container_name: The name of the Storage blob container that is the destination of + :vartype resource_id: str + :ivar blob_container_name: The name of the Storage blob container that is the destination of the deadletter events. - :type blob_container_name: str + :vartype blob_container_name: str """ _validation = { @@ -2267,6 +2990,14 @@ def __init__( blob_container_name: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of the storage account that is the destination of + the deadletter events. + :paramtype resource_id: str + :keyword blob_container_name: The name of the Storage blob container that is the destination of + the deadletter events. + :paramtype blob_container_name: str + """ super(StorageBlobDeadLetterDestination, self).__init__(**kwargs) self.endpoint_type = 'StorageBlob' # type: str self.resource_id = resource_id @@ -2278,18 +3009,18 @@ class StorageQueueEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param resource_id: The Azure Resource ID of the storage account that contains the queue that - is the destination of an event subscription. - :type resource_id: str - :param queue_name: The name of the Storage queue under a storage account that is the - destination of an event subscription. - :type queue_name: str - :param queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. - :type queue_message_time_to_live_in_seconds: long + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar resource_id: The Azure Resource ID of the storage account that contains the queue that is + the destination of an event subscription. + :vartype resource_id: str + :ivar queue_name: The name of the Storage queue under a storage account that is the destination + of an event subscription. + :vartype queue_name: str + :ivar queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. + :vartype queue_message_time_to_live_in_seconds: long """ _validation = { @@ -2311,6 +3042,16 @@ def __init__( queue_message_time_to_live_in_seconds: Optional[int] = None, **kwargs ): + """ + :keyword resource_id: The Azure Resource ID of the storage account that contains the queue that + is the destination of an event subscription. + :paramtype resource_id: str + :keyword queue_name: The name of the Storage queue under a storage account that is the + destination of an event subscription. + :paramtype queue_name: str + :keyword queue_message_time_to_live_in_seconds: Storage queue message time to live in seconds. + :paramtype queue_message_time_to_live_in_seconds: long + """ super(StorageQueueEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'StorageQueue' # type: str self.resource_id = resource_id @@ -2323,16 +3064,17 @@ class StringBeginsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2352,6 +3094,12 @@ def __init__( values: Optional[List[str]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringBeginsWithAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'StringBeginsWith' # type: str self.values = values @@ -2362,16 +3110,17 @@ class StringContainsAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2391,6 +3140,12 @@ def __init__( values: Optional[List[str]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringContainsAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'StringContains' # type: str self.values = values @@ -2401,16 +3156,17 @@ class StringEndsWithAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2430,6 +3186,12 @@ def __init__( values: Optional[List[str]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringEndsWithAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'StringEndsWith' # type: str self.values = values @@ -2440,16 +3202,17 @@ class StringInAdvancedFilter(AdvancedFilter): All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2469,26 +3232,171 @@ def __init__( values: Optional[List[str]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringInAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'StringIn' # type: str self.values = values +class StringNotBeginsWithAdvancedFilter(AdvancedFilter): + """StringNotBeginsWith Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotBeginsWithAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringNotBeginsWith' # type: str + self.values = values + + +class StringNotContainsAdvancedFilter(AdvancedFilter): + """StringNotContains Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotContainsAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringNotContains' # type: str + self.values = values + + +class StringNotEndsWithAdvancedFilter(AdvancedFilter): + """StringNotEndsWith Advanced Filter. + + All required parameters must be populated in order to send to Azure. + + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: + "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", + "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] + """ + + _validation = { + 'operator_type': {'required': True}, + } + + _attribute_map = { + 'operator_type': {'key': 'operatorType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + values: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ + super(StringNotEndsWithAdvancedFilter, self).__init__(key=key, **kwargs) + self.operator_type = 'StringNotEndsWith' # type: str + self.values = values + + class StringNotInAdvancedFilter(AdvancedFilter): """StringNotIn Advanced Filter. All required parameters must be populated in order to send to Azure. - :param operator_type: Required. The operator type used for filtering, e.g., NumberIn, - StringContains, BoolEquals and others.Constant filled by server. Possible values include: + :ivar operator_type: Required. The operator type used for filtering, e.g., NumberIn, + StringContains, BoolEquals and others.Constant filled by server. Possible values include: "NumberIn", "NumberNotIn", "NumberLessThan", "NumberGreaterThan", "NumberLessThanOrEquals", "NumberGreaterThanOrEquals", "BoolEquals", "StringIn", "StringNotIn", "StringBeginsWith", - "StringEndsWith", "StringContains". - :type operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType - :param key: The field/property in the event based on which you want to filter. - :type key: str - :param values: The set of filter values. - :type values: list[str] + "StringEndsWith", "StringContains", "NumberInRange", "NumberNotInRange", "StringNotBeginsWith", + "StringNotEndsWith", "StringNotContains", "IsNullOrUndefined", "IsNotNull". + :vartype operator_type: str or ~azure.mgmt.eventgrid.models.AdvancedFilterOperatorType + :ivar key: The field/property in the event based on which you want to filter. + :vartype key: str + :ivar values: The set of filter values. + :vartype values: list[str] """ _validation = { @@ -2508,6 +3416,12 @@ def __init__( values: Optional[List[str]] = None, **kwargs ): + """ + :keyword key: The field/property in the event based on which you want to filter. + :paramtype key: str + :keyword values: The set of filter values. + :paramtype values: list[str] + """ super(StringNotInAdvancedFilter, self).__init__(key=key, **kwargs) self.operator_type = 'StringNotIn' # type: str self.values = values @@ -2516,20 +3430,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2552,6 +3466,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.eventgrid.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2574,21 +3504,21 @@ class SystemTopic(TrackedResource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar system_data: The system metadata relating to System Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar provisioning_state: Provisioning state of the system topic. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.ResourceProvisioningState - :param source: Source for the system topic. - :type source: str - :param topic_type: TopicType for the system topic. - :type topic_type: str + :ivar source: Source for the system topic. + :vartype source: str + :ivar topic_type: TopicType for the system topic. + :vartype topic_type: str :ivar metric_resource_id: Metric resource id for the system topic. :vartype metric_resource_id: str """ @@ -2627,6 +3557,18 @@ def __init__( topic_type: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword source: Source for the system topic. + :paramtype source: str + :keyword topic_type: TopicType for the system topic. + :paramtype topic_type: str + """ super(SystemTopic, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.system_data = None @@ -2639,10 +3581,10 @@ def __init__( class SystemTopicsListResult(msrest.serialization.Model): """Result of the List System topics operation. - :param value: A collection of system Topics. - :type value: list[~azure.mgmt.eventgrid.models.SystemTopic] - :param next_link: A link for the next page of topics. - :type next_link: str + :ivar value: A collection of system Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.SystemTopic] + :ivar next_link: A link for the next page of topics. + :vartype next_link: str """ _attribute_map = { @@ -2657,6 +3599,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of system Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.SystemTopic] + :keyword next_link: A link for the next page of topics. + :paramtype next_link: str + """ super(SystemTopicsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2665,10 +3613,10 @@ def __init__( class SystemTopicUpdateParameters(msrest.serialization.Model): """Properties of the System Topic update. - :param tags: A set of tags. Tags of the system topic. - :type tags: dict[str, str] - :param identity: Resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar tags: A set of tags. Tags of the system topic. + :vartype tags: dict[str, str] + :ivar identity: Resource identity information. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo """ _attribute_map = { @@ -2683,6 +3631,12 @@ def __init__( identity: Optional["IdentityInfo"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the system topic. + :paramtype tags: dict[str, str] + :keyword identity: Resource identity information. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + """ super(SystemTopicUpdateParameters, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -2701,12 +3655,12 @@ class Topic(TrackedResource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param location: Required. Location of the resource. - :type location: str - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Identity information for the resource. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar location: Required. Location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Identity information for the resource. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo :ivar system_data: The system metadata relating to Topic resource. :vartype system_data: ~azure.mgmt.eventgrid.models.SystemData :ivar private_endpoint_connections: @@ -2717,29 +3671,29 @@ class Topic(TrackedResource): :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicProvisioningState :ivar endpoint: Endpoint for the topic. :vartype endpoint: str - :param input_schema: This determines the format that Event Grid should expect for incoming + :ivar input_schema: This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", "CloudEventSchemaV1_0". - :type input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema - :param input_schema_mapping: This enables publishing using custom event schemas. An + :vartype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :ivar input_schema_mapping: This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - :type input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :vartype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping :ivar metric_resource_id: Metric resource id for the topic. :vartype metric_resource_id: str - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. - :type disable_local_auth: bool + :vartype disable_local_auth: bool """ _validation = { @@ -2786,6 +3740,35 @@ def __init__( disable_local_auth: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. Location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Identity information for the resource. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword input_schema: This determines the format that Event Grid should expect for incoming + events published to the topic. Possible values include: "EventGridSchema", "CustomEventSchema", + "CloudEventSchemaV1_0". + :paramtype input_schema: str or ~azure.mgmt.eventgrid.models.InputSchema + :keyword input_schema_mapping: This enables publishing using custom event schemas. An + InputSchemaMapping can be specified to map various properties of a source schema to various + required properties of the EventGridEvent schema. + :paramtype input_schema_mapping: ~azure.mgmt.eventgrid.models.InputSchemaMapping + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the topic. + :paramtype disable_local_auth: bool + """ super(Topic, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.system_data = None @@ -2805,8 +3788,8 @@ class TopicRegenerateKeyRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. Key name to regenerate key1 or key2. - :type key_name: str + :ivar key_name: Required. Key name to regenerate key1 or key2. + :vartype key_name: str """ _validation = { @@ -2823,6 +3806,10 @@ def __init__( key_name: str, **kwargs ): + """ + :keyword key_name: Required. Key name to regenerate key1 or key2. + :paramtype key_name: str + """ super(TopicRegenerateKeyRequest, self).__init__(**kwargs) self.key_name = key_name @@ -2830,10 +3817,10 @@ def __init__( class TopicSharedAccessKeys(msrest.serialization.Model): """Shared access keys of the Topic. - :param key1: Shared access key1 for the topic. - :type key1: str - :param key2: Shared access key2 for the topic. - :type key2: str + :ivar key1: Shared access key1 for the topic. + :vartype key1: str + :ivar key2: Shared access key2 for the topic. + :vartype key2: str """ _attribute_map = { @@ -2848,6 +3835,12 @@ def __init__( key2: Optional[str] = None, **kwargs ): + """ + :keyword key1: Shared access key1 for the topic. + :paramtype key1: str + :keyword key2: Shared access key2 for the topic. + :paramtype key2: str + """ super(TopicSharedAccessKeys, self).__init__(**kwargs) self.key1 = key1 self.key2 = key2 @@ -2856,10 +3849,10 @@ def __init__( class TopicsListResult(msrest.serialization.Model): """Result of the List Topics operation. - :param value: A collection of Topics. - :type value: list[~azure.mgmt.eventgrid.models.Topic] - :param next_link: A link for the next page of topics. - :type next_link: str + :ivar value: A collection of Topics. + :vartype value: list[~azure.mgmt.eventgrid.models.Topic] + :ivar next_link: A link for the next page of topics. + :vartype next_link: str """ _attribute_map = { @@ -2874,6 +3867,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Topics. + :paramtype value: list[~azure.mgmt.eventgrid.models.Topic] + :keyword next_link: A link for the next page of topics. + :paramtype next_link: str + """ super(TopicsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2890,24 +3889,24 @@ class TopicTypeInfo(Resource): :vartype name: str :ivar type: Type of the resource. :vartype type: str - :param provider: Namespace of the provider of the topic type. - :type provider: str - :param display_name: Display Name for the topic type. - :type display_name: str - :param description: Description of the topic type. - :type description: str - :param resource_region_type: Region type of the resource. Possible values include: + :ivar provider: Namespace of the provider of the topic type. + :vartype provider: str + :ivar display_name: Display Name for the topic type. + :vartype display_name: str + :ivar description: Description of the topic type. + :vartype description: str + :ivar resource_region_type: Region type of the resource. Possible values include: "RegionalResource", "GlobalResource". - :type resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType - :param provisioning_state: Provisioning state of the topic type. Possible values include: + :vartype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :ivar provisioning_state: Provisioning state of the topic type. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState - :param supported_locations: List of locations supported by this topic type. - :type supported_locations: list[str] - :param source_resource_format: Source resource format. - :type source_resource_format: str - :param supported_scopes_for_source: Supported source scopes. - :type supported_scopes_for_source: list[str or + :vartype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :ivar supported_locations: List of locations supported by this topic type. + :vartype supported_locations: list[str] + :ivar source_resource_format: Source resource format. + :vartype source_resource_format: str + :ivar supported_scopes_for_source: Supported source scopes. + :vartype supported_scopes_for_source: list[str or ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] """ @@ -2944,6 +3943,27 @@ def __init__( supported_scopes_for_source: Optional[List[Union[str, "TopicTypePropertiesSupportedScopesForSourceItem"]]] = None, **kwargs ): + """ + :keyword provider: Namespace of the provider of the topic type. + :paramtype provider: str + :keyword display_name: Display Name for the topic type. + :paramtype display_name: str + :keyword description: Description of the topic type. + :paramtype description: str + :keyword resource_region_type: Region type of the resource. Possible values include: + "RegionalResource", "GlobalResource". + :paramtype resource_region_type: str or ~azure.mgmt.eventgrid.models.ResourceRegionType + :keyword provisioning_state: Provisioning state of the topic type. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or ~azure.mgmt.eventgrid.models.TopicTypeProvisioningState + :keyword supported_locations: List of locations supported by this topic type. + :paramtype supported_locations: list[str] + :keyword source_resource_format: Source resource format. + :paramtype source_resource_format: str + :keyword supported_scopes_for_source: Supported source scopes. + :paramtype supported_scopes_for_source: list[str or + ~azure.mgmt.eventgrid.models.TopicTypePropertiesSupportedScopesForSourceItem] + """ super(TopicTypeInfo, self).__init__(**kwargs) self.provider = provider self.display_name = display_name @@ -2958,8 +3978,8 @@ def __init__( class TopicTypesListResult(msrest.serialization.Model): """Result of the List Topic Types operation. - :param value: A collection of topic types. - :type value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + :ivar value: A collection of topic types. + :vartype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] """ _attribute_map = { @@ -2972,6 +3992,10 @@ def __init__( value: Optional[List["TopicTypeInfo"]] = None, **kwargs ): + """ + :keyword value: A collection of topic types. + :paramtype value: list[~azure.mgmt.eventgrid.models.TopicTypeInfo] + """ super(TopicTypesListResult, self).__init__(**kwargs) self.value = value @@ -2979,23 +4003,23 @@ def __init__( class TopicUpdateParameters(msrest.serialization.Model): """Properties of the Topic update. - :param tags: A set of tags. Tags of the resource. - :type tags: dict[str, str] - :param identity: Topic resource identity information. - :type identity: ~azure.mgmt.eventgrid.models.IdentityInfo - :param public_network_access: This determines if traffic is allowed over public network. By + :ivar tags: A set of tags. Tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: Topic resource identity information. + :vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :ivar public_network_access: This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". - :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 + :vartype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :ivar inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - :type inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] - :param disable_local_auth: This boolean is used to enable or disable local auth. Default value + :vartype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :ivar disable_local_auth: This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. - :type disable_local_auth: bool + :vartype disable_local_auth: bool """ _attribute_map = { @@ -3016,6 +4040,25 @@ def __init__( disable_local_auth: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: Topic resource identity information. + :paramtype identity: ~azure.mgmt.eventgrid.models.IdentityInfo + :keyword public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. + You can further restrict to specific IPs by configuring :code:``. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.eventgrid.models.PublicNetworkAccess + :keyword inbound_ip_rules: This can be used to restrict traffic from specific IPs instead of + all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + :paramtype inbound_ip_rules: list[~azure.mgmt.eventgrid.models.InboundIpRule] + :keyword disable_local_auth: This boolean is used to enable or disable local auth. Default + value is false. When the property is set to true, only AAD token will be used to authenticate + if user is allowed to publish to the topic. + :paramtype disable_local_auth: bool + """ super(TopicUpdateParameters, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -3027,10 +4070,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.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 + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -3045,6 +4088,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -3057,28 +4106,29 @@ class WebHookEventSubscriptionDestination(EventSubscriptionDestination): All required parameters must be populated in order to send to Azure. - :param endpoint_type: Required. Type of the endpoint for the event subscription - destination.Constant filled by server. Possible values include: "WebHook", "EventHub", + :ivar endpoint_type: Required. Type of the endpoint for the event subscription + destination.Constant filled by server. Possible values include: "WebHook", "EventHub", "StorageQueue", "HybridConnection", "ServiceBusQueue", "ServiceBusTopic", "AzureFunction". - :type endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType - :param endpoint_url: The URL that represents the endpoint of the destination of an event + :vartype endpoint_type: str or ~azure.mgmt.eventgrid.models.EndpointType + :ivar endpoint_url: The URL that represents the endpoint of the destination of an event subscription. - :type endpoint_url: str + :vartype endpoint_url: str :ivar endpoint_base_url: The base URL that represents the endpoint of the destination of an event subscription. :vartype endpoint_base_url: str - :param max_events_per_batch: Maximum number of events per batch. - :type max_events_per_batch: int - :param preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. - :type preferred_batch_size_in_kilobytes: int - :param azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access + :ivar max_events_per_batch: Maximum number of events per batch. + :vartype max_events_per_batch: int + :ivar preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :vartype preferred_batch_size_in_kilobytes: int + :ivar azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - :type azure_active_directory_tenant_id: str - :param azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID + :vartype azure_active_directory_tenant_id: str + :ivar azure_active_directory_application_id_or_uri: The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. - :type azure_active_directory_application_id_or_uri: str - :param delivery_attribute_mappings: Delivery attribute details. - :type delivery_attribute_mappings: list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + :vartype azure_active_directory_application_id_or_uri: str + :ivar delivery_attribute_mappings: Delivery attribute details. + :vartype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] """ _validation = { @@ -3108,6 +4158,25 @@ def __init__( delivery_attribute_mappings: Optional[List["DeliveryAttributeMapping"]] = None, **kwargs ): + """ + :keyword endpoint_url: The URL that represents the endpoint of the destination of an event + subscription. + :paramtype endpoint_url: str + :keyword max_events_per_batch: Maximum number of events per batch. + :paramtype max_events_per_batch: int + :keyword preferred_batch_size_in_kilobytes: Preferred batch size in Kilobytes. + :paramtype preferred_batch_size_in_kilobytes: int + :keyword azure_active_directory_tenant_id: The Azure Active Directory Tenant ID to get the + access token that will be included as the bearer token in delivery requests. + :paramtype azure_active_directory_tenant_id: str + :keyword azure_active_directory_application_id_or_uri: The Azure Active Directory Application + ID or URI to get the access token that will be included as the bearer token in delivery + requests. + :paramtype azure_active_directory_application_id_or_uri: str + :keyword delivery_attribute_mappings: Delivery attribute details. + :paramtype delivery_attribute_mappings: + list[~azure.mgmt.eventgrid.models.DeliveryAttributeMapping] + """ super(WebHookEventSubscriptionDestination, self).__init__(**kwargs) self.endpoint_type = 'WebHook' # type: str self.endpoint_url = endpoint_url diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py index 8fbab794e0d6..d172596cdbb6 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py @@ -5,26 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "domainTopicName": _SERIALIZER.url("domain_topic_name", domain_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "domainTopicName": _SERIALIZER.url("domain_topic_name", domain_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + domain_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "domainTopicName": _SERIALIZER.url("domain_topic_name", domain_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_domain_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DomainTopicsOperations(object): """DomainTopicsOperations operations. @@ -47,6 +206,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -75,28 +235,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,8 +260,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -125,28 +277,18 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -160,8 +302,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -182,15 +327,18 @@ def begin_create_or_update( :type domain_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DomainTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DomainTopic or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.DomainTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -205,25 +353,17 @@ def begin_create_or_update( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DomainTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +375,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore def _delete_initial( @@ -250,26 +391,18 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + domain_topic_name=domain_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -282,6 +415,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -302,15 +437,17 @@ def begin_delete( :type domain_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -325,22 +462,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'domainTopicName': self._serialize.url("domain_topic_name", domain_topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -352,8 +481,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}'} # type: ignore + @distributed_trace def list_by_domain( self, resource_group_name, # type: str @@ -383,7 +514,8 @@ def list_by_domain( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DomainTopicsListResult or the result of cls(response) + :return: An iterator like instance of either DomainTopicsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.DomainTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -392,40 +524,37 @@ def list_by_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + filter=filter, + top=top, + template_url=self.list_by_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DomainTopicsListResult', pipeline_response) + deserialized = self._deserialize("DomainTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -443,6 +572,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 0465caf51a3a..b91e5c005869 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 @@ -5,26 +5,336 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_shared_access_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DomainsOperations(object): """DomainsOperations operations. @@ -47,6 +357,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -72,27 +383,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +407,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -121,32 +424,22 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(domain_info, 'Domain') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_info, 'Domain') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -160,8 +453,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -182,15 +478,18 @@ def begin_create_or_update( :type domain_info: ~azure.mgmt.eventgrid.models.Domain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Domain or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Domain] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Domain"] lro_delay = kwargs.pop( 'polling_interval', @@ -202,27 +501,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, domain_name=domain_name, domain_info=domain_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Domain', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -234,6 +527,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def _delete_initial( @@ -248,25 +542,17 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,6 +565,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -296,15 +584,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -318,21 +608,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,6 +627,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore def _update_initial( @@ -359,32 +643,22 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_update_parameters, 'DomainUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,8 +674,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -422,15 +699,18 @@ def begin_update( :type domain_update_parameters: ~azure.mgmt.eventgrid.models.DomainUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Domain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Domain] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Domain"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,27 +722,21 @@ def begin_update( resource_group_name=resource_group_name, domain_name=domain_name, domain_update_parameters=domain_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Domain', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -474,8 +748,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter=None, # type: Optional[str] @@ -508,38 +784,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DomainsListResult', pipeline_response) + deserialized = self._deserialize("DomainsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -557,11 +828,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -597,39 +870,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DomainsListResult', pipeline_response) + deserialized = self._deserialize("DomainsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,11 +916,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains'} # type: ignore + @distributed_trace def list_shared_access_keys( self, resource_group_name, # type: str @@ -677,27 +948,17 @@ def list_shared_access_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_shared_access_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +972,11 @@ def list_shared_access_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, resource_group_name, # type: str @@ -741,32 +1005,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key_request, 'DomainRegenerateKeyRequest') + + request = build_regenerate_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_request, 'DomainRegenerateKeyRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -780,4 +1034,6 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py index 500d406cd45f..4d3ca7bf1d54 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py @@ -5,26 +5,668 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_full_url_request( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_global_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_global_by_subscription_for_topic_type_request( + subscription_id, # type: str + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_global_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_global_by_resource_group_for_topic_type_request( + subscription_id, # type: str + resource_group_name, # type: str + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_regional_by_subscription_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_regional_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_regional_by_subscription_for_topic_type_request( + subscription_id, # type: str + location, # type: str + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_regional_by_resource_group_for_topic_type_request( + subscription_id, # type: str + resource_group_name, # type: str + location, # type: str + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + provider_namespace, # type: str + resource_type_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, 'str'), + "resourceTypeName": _SERIALIZER.url("resource_type_name", resource_type_name, 'str'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_domain_topic_request( + subscription_id, # type: str + resource_group_name, # type: str + domain_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + scope, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str', skip_quote=True), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class EventSubscriptionsOperations(object): """EventSubscriptionsOperations operations. @@ -47,6 +689,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, scope, # type: str @@ -79,26 +722,16 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +745,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + def _create_or_update_initial( self, scope, # type: str @@ -127,31 +762,21 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_info, 'EventSubscription') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -165,8 +790,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, scope, # type: str @@ -198,15 +826,19 @@ def begin_create_or_update( :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,26 +850,21 @@ def begin_create_or_update( scope=scope, event_subscription_name=event_subscription_name, event_subscription_info=event_subscription_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,6 +876,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _delete_initial( @@ -263,24 +891,16 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,6 +913,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_delete( self, scope, # type: str @@ -317,15 +939,17 @@ def begin_delete( :type event_subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,20 +963,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +982,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _update_initial( @@ -379,31 +998,21 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') + + request = build_update_request_initial( + scope=scope, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -417,8 +1026,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_update( self, scope, # type: str @@ -443,18 +1055,23 @@ def begin_update( :param event_subscription_name: Name of the event subscription to be updated. :type event_subscription_name: str :param event_subscription_update_parameters: Updated event subscription information. - :type event_subscription_update_parameters: ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -466,26 +1083,21 @@ def begin_update( scope=scope, event_subscription_name=event_subscription_name, event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -497,8 +1109,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + @distributed_trace def get_full_url( self, scope, # type: str @@ -531,26 +1145,16 @@ def get_full_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_full_url.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_full_url_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -564,8 +1168,11 @@ def get_full_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_full_url.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + @distributed_trace def list_global_by_subscription( self, filter=None, # type: Optional[str] @@ -589,7 +1196,8 @@ def list_global_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -598,38 +1206,33 @@ def list_global_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_global_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,11 +1250,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_global_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_subscription_for_topic_type( self, topic_type_name, # type: str @@ -678,7 +1283,8 @@ def list_global_by_subscription_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -687,39 +1293,35 @@ def list_global_by_subscription_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_subscription_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_global_by_subscription_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -737,11 +1339,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_global_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_resource_group( self, resource_group_name, # type: str @@ -768,7 +1372,8 @@ def list_global_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -777,39 +1382,35 @@ def list_global_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_global_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,11 +1428,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_global_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_global_by_resource_group_for_topic_type( self, resource_group_name, # type: str @@ -861,7 +1464,8 @@ def list_global_by_resource_group_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -870,40 +1474,37 @@ def list_global_by_resource_group_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_global_by_resource_group_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_global_by_resource_group_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_global_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -921,11 +1522,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_global_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_subscription( self, location, # type: str @@ -952,7 +1555,8 @@ def list_regional_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -961,39 +1565,35 @@ def list_regional_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_request( + subscription_id=self._config.subscription_id, + location=location, + filter=filter, + top=top, + template_url=self.list_regional_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_request( + subscription_id=self._config.subscription_id, + location=location, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1011,11 +1611,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_regional_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_resource_group( self, resource_group_name, # type: str @@ -1046,7 +1648,8 @@ def list_regional_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1055,40 +1658,37 @@ def list_regional_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + filter=filter, + top=top, + template_url=self.list_regional_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1106,11 +1706,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_regional_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_subscription_for_topic_type( self, location, # type: str @@ -1141,7 +1743,8 @@ def list_regional_by_subscription_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1150,40 +1753,37 @@ def list_regional_by_subscription_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_subscription_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_regional_by_subscription_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_subscription_for_topic_type_request( + subscription_id=self._config.subscription_id, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1201,11 +1801,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_regional_by_subscription_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_regional_by_resource_group_for_topic_type( self, resource_group_name, # type: str @@ -1216,7 +1818,8 @@ def list_regional_by_resource_group_for_topic_type( **kwargs # type: Any ): # type: (...) -> Iterable["_models.EventSubscriptionsListResult"] - """List all regional event subscriptions under an Azure subscription and resource group for a topic type. + """List all regional event subscriptions under an Azure subscription and resource group for a + topic type. List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. @@ -1239,7 +1842,8 @@ def list_regional_by_resource_group_for_topic_type( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1248,41 +1852,39 @@ def list_regional_by_resource_group_for_topic_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_regional_by_resource_group_for_topic_type.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=self.list_regional_by_resource_group_for_topic_type.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_regional_by_resource_group_for_topic_type_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + topic_type_name=topic_type_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1300,11 +1902,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_regional_by_resource_group_for_topic_type.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name, # type: str @@ -1340,7 +1944,8 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1349,42 +1954,41 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), - 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1402,11 +2006,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def list_by_domain_topic( self, resource_group_name, # type: str @@ -1439,7 +2045,8 @@ def list_by_domain_topic( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1448,41 +2055,39 @@ def list_by_domain_topic( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_domain_topic.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + filter=filter, + top=top, + template_url=self.list_by_domain_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_domain_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + domain_name=domain_name, + topic_name=topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1500,11 +2105,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_domain_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions'} # type: ignore + @distributed_trace def get_delivery_attributes( self, scope, # type: str @@ -1537,26 +2144,16 @@ def get_delivery_attributes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_delivery_attributes.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), - 'eventSubscriptionName': self._serialize.url("event_subscription_name", event_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_delivery_attributes_request( + scope=scope, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1570,4 +2167,6 @@ def get_delivery_attributes( return cls(pipeline_response, deserialized, {}) return deserialized + get_delivery_attributes.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py index ff73c2935ffd..ef52811d9820 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py @@ -5,23 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + scope, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default') + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ExtensionTopicsOperations(object): """ExtensionTopicsOperations operations. @@ -44,6 +84,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, scope, # type: str @@ -71,25 +112,15 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'scope': self._serialize.url("scope", scope, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + scope=scope, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,4 +134,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.EventGrid/extensionTopics/default'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py index cf886591d16b..2095a18b040f 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -55,7 +90,8 @@ def list( List the available operations supported by the Microsoft.EventGrid resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsListResult or the result of cls(response) + :return: An iterator like instance of either OperationsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.OperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -64,30 +100,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsListResult', pipeline_response) + deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +138,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py index 873bdf7a1e6f..21eb3fc848d2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py @@ -5,26 +5,197 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: Union[str, "_models.Enum18"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: Union[str, "_models.Enum19"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: Union[str, "_models.Enum20"] + parent_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_by_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: Union[str, "_models.Enum21"] + parent_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,6 +218,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -81,29 +253,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,8 +279,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _update_initial( self, resource_group_name, # type: str @@ -134,34 +298,24 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +333,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -210,15 +367,19 @@ def begin_update( :type private_endpoint_connection: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -232,29 +393,21 @@ def begin_update( parent_name=parent_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -266,6 +419,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( @@ -282,27 +436,19 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,6 +461,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -341,15 +489,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -365,23 +515,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -393,8 +534,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name, # type: str @@ -429,8 +572,10 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -438,41 +583,39 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -490,6 +633,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py index fe960f501f0d..e080604250bb 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py @@ -5,24 +5,117 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: str + parent_name, # type: str + private_link_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + parent_type, # type: str + parent_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "parentType": _SERIALIZER.url("parent_type", parent_type, 'str'), + "parentName": _SERIALIZER.url("parent_name", parent_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,6 +138,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -78,29 +172,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,8 +198,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + + @distributed_trace def list_by_resource( self, resource_group_name, # type: str @@ -150,8 +237,10 @@ def list_by_resource( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.PrivateLinkResourcesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] @@ -159,41 +248,39 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'parentType': self._serialize.url("parent_type", parent_type, 'str'), - 'parentName': self._serialize.url("parent_name", parent_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_type=parent_type, + parent_name=parent_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -211,6 +298,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py index ad44916408ad..ac624e9144ff 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py @@ -5,26 +5,307 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_full_url_request( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_system_topic_request( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_delivery_attributes_request( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + event_subscription_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + "eventSubscriptionName": _SERIALIZER.url("event_subscription_name", event_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SystemTopicEventSubscriptionsOperations(object): """SystemTopicEventSubscriptionsOperations operations. @@ -47,6 +328,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,28 +359,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +384,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -128,33 +402,23 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(event_subscription_info, 'EventSubscription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_info, 'EventSubscription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,8 +432,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -197,15 +464,19 @@ def begin_create_or_update( :type event_subscription_info: ~azure.mgmt.eventgrid.models.EventSubscription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,28 +489,21 @@ def begin_create_or_update( system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, event_subscription_info=event_subscription_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -251,6 +515,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _delete_initial( @@ -266,26 +531,18 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -298,6 +555,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -320,15 +579,17 @@ def begin_delete( :type event_subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -343,22 +604,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -370,6 +623,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore def _update_initial( @@ -386,33 +640,23 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(event_subscription_update_parameters, 'EventSubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -426,8 +670,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -450,18 +697,23 @@ def begin_update( 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 + :type event_subscription_update_parameters: + ~azure.mgmt.eventgrid.models.EventSubscriptionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either EventSubscription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EventSubscription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.EventSubscription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EventSubscription"] lro_delay = kwargs.pop( 'polling_interval', @@ -474,28 +726,21 @@ def begin_update( system_topic_name=system_topic_name, event_subscription_name=event_subscription_name, event_subscription_update_parameters=event_subscription_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EventSubscription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,8 +752,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}'} # type: ignore + @distributed_trace def get_full_url( self, resource_group_name, # type: str @@ -539,28 +786,18 @@ def get_full_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_full_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_full_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_full_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -574,8 +811,11 @@ def get_full_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_full_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl'} # type: ignore + + @distributed_trace def list_by_system_topic( self, resource_group_name, # type: str @@ -605,7 +845,8 @@ def list_by_system_topic( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventSubscriptionsListResult or the result of cls(response) + :return: An iterator like instance of either EventSubscriptionsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventSubscriptionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -614,40 +855,37 @@ def list_by_system_topic( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_system_topic.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_system_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + filter=filter, + top=top, + template_url=self.list_by_system_topic.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_system_topic_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventSubscriptionsListResult', pipeline_response) + deserialized = self._deserialize("EventSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -665,11 +903,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_system_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions'} # type: ignore + @distributed_trace def get_delivery_attributes( self, resource_group_name, # type: str @@ -700,28 +940,18 @@ def get_delivery_attributes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get_delivery_attributes.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_delivery_attributes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + event_subscription_name=event_subscription_name, + template_url=self.get_delivery_attributes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -735,4 +965,6 @@ def get_delivery_attributes( return cls(pipeline_response, deserialized, {}) return deserialized + get_delivery_attributes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes'} # type: ignore + diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py index a0f32fc87631..a43cb2f189d2 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py @@ -5,26 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + system_topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "systemTopicName": _SERIALIZER.url("system_topic_name", system_topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SystemTopicsOperations(object): """SystemTopicsOperations operations. @@ -47,6 +281,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -72,27 +307,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +331,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -121,32 +348,22 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(system_topic_info, 'SystemTopic') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(system_topic_info, 'SystemTopic') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,8 +381,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -186,15 +406,19 @@ def begin_create_or_update( :type system_topic_info: ~azure.mgmt.eventgrid.models.SystemTopic :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SystemTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SystemTopic or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.SystemTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,27 +430,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, system_topic_name=system_topic_name, system_topic_info=system_topic_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SystemTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -238,6 +456,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore def _delete_initial( @@ -252,25 +471,17 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,6 +494,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -300,15 +513,17 @@ def begin_delete( :type system_topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -322,21 +537,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,6 +556,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore def _update_initial( @@ -363,32 +572,22 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'systemTopicName': self._serialize.url("system_topic_name", system_topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + system_topic_name=system_topic_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(system_topic_update_parameters, 'SystemTopicUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -406,8 +605,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -428,15 +630,19 @@ def begin_update( :type system_topic_update_parameters: ~azure.mgmt.eventgrid.models.SystemTopicUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SystemTopic or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SystemTopic or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.SystemTopic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SystemTopic"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,27 +654,21 @@ def begin_update( resource_group_name=resource_group_name, system_topic_name=system_topic_name, system_topic_update_parameters=system_topic_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SystemTopic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -480,8 +680,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter=None, # type: Optional[str] @@ -505,7 +707,8 @@ def list_by_subscription( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SystemTopicsListResult or the result of cls(response) + :return: An iterator like instance of either SystemTopicsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -514,38 +717,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SystemTopicsListResult', pipeline_response) + deserialized = self._deserialize("SystemTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +761,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -594,7 +794,8 @@ def list_by_resource_group( items per page. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SystemTopicsListResult or the result of cls(response) + :return: An iterator like instance of either SystemTopicsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.SystemTopicsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -603,39 +804,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SystemTopicsListResult', pipeline_response) + deserialized = self._deserialize("SystemTopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -653,6 +850,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py index 1a6702a430ef..c16e46efab75 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py @@ -5,24 +5,122 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}') + path_format_arguments = { + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_event_types_request( + topic_type_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes') + path_format_arguments = { + "topicTypeName": _SERIALIZER.url("topic_type_name", topic_type_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TopicTypesOperations(object): """TopicTypesOperations operations. @@ -45,6 +143,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -55,7 +154,8 @@ def list( List all registered topic types. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopicTypesListResult or the result of cls(response) + :return: An iterator like instance of either TopicTypesListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.TopicTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -64,30 +164,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TopicTypesListResult', pipeline_response) + deserialized = self._deserialize("TopicTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,11 +202,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes'} # type: ignore + @distributed_trace def get( self, topic_type_name, # type: str @@ -132,25 +231,15 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + topic_type_name=topic_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -164,8 +253,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}'} # type: ignore + + @distributed_trace def list_event_types( self, topic_type_name, # type: str @@ -179,7 +271,8 @@ def list_event_types( :param topic_type_name: Name of the topic type. :type topic_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :return: An iterator like instance of either EventTypesListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -188,34 +281,29 @@ def list_event_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_event_types.metadata['url'] # type: ignore - path_format_arguments = { - 'topicTypeName': self._serialize.url("topic_type_name", topic_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + topic_type_name=topic_type_name, + template_url=self.list_event_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + topic_type_name=topic_type_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventTypesListResult', pipeline_response) + deserialized = self._deserialize("EventTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -233,6 +321,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) 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 9e93009e0b95..6d0c1d9b0611 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 @@ -5,26 +5,376 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_shared_access_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + topic_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "topicName": _SERIALIZER.url("topic_name", topic_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_event_types_request( + subscription_id, # type: str + resource_group_name, # type: str + provider_namespace, # type: str + resource_type_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, 'str'), + "resourceTypeName": _SERIALIZER.url("resource_type_name", resource_type_name, 'str'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TopicsOperations(object): """TopicsOperations operations. @@ -47,6 +397,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -72,27 +423,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,8 +447,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -121,32 +464,22 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(topic_info, 'Topic') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(topic_info, 'Topic') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -160,8 +493,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -182,15 +518,18 @@ def begin_create_or_update( :type topic_info: ~azure.mgmt.eventgrid.models.Topic :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Topic or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Topic] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Topic"] lro_delay = kwargs.pop( 'polling_interval', @@ -202,27 +541,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, topic_name=topic_name, topic_info=topic_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Topic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -234,6 +567,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def _delete_initial( @@ -248,25 +582,17 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,6 +605,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -296,15 +624,17 @@ def begin_delete( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -318,21 +648,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -344,6 +667,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore def _update_initial( @@ -359,32 +683,22 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(topic_update_parameters, 'TopicUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,8 +714,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -422,15 +739,18 @@ def begin_update( :type topic_update_parameters: ~azure.mgmt.eventgrid.models.TopicUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Topic or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.Topic] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Topic"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,27 +762,21 @@ def begin_update( resource_group_name=resource_group_name, topic_name=topic_name, topic_update_parameters=topic_update_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Topic', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -474,8 +788,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'} # type: ignore + @distributed_trace def list_by_subscription( self, filter=None, # type: Optional[str] @@ -508,38 +824,33 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TopicsListResult', pipeline_response) + deserialized = self._deserialize("TopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -557,11 +868,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -597,39 +910,35 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + filter=filter, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TopicsListResult', pipeline_response) + deserialized = self._deserialize("TopicsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,11 +956,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics'} # type: ignore + @distributed_trace def list_shared_access_keys( self, resource_group_name, # type: str @@ -677,27 +988,17 @@ def list_shared_access_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - - # Construct URL - url = self.list_shared_access_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_shared_access_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + template_url=self.list_shared_access_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,8 +1012,10 @@ def list_shared_access_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_shared_access_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys'} # type: ignore + def _regenerate_key_initial( self, resource_group_name, # type: str @@ -726,32 +1029,22 @@ def _regenerate_key_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._regenerate_key_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(regenerate_key_request, 'TopicRegenerateKeyRequest') + + request = build_regenerate_key_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + topic_name=topic_name, + content_type=content_type, + json=_json, + template_url=self._regenerate_key_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_request, 'TopicRegenerateKeyRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -765,8 +1058,11 @@ def _regenerate_key_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore + + @distributed_trace def begin_regenerate_key( self, resource_group_name, # type: str @@ -787,15 +1083,19 @@ def begin_regenerate_key( :type regenerate_key_request: ~azure.mgmt.eventgrid.models.TopicRegenerateKeyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either TopicSharedAccessKeys or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either TopicSharedAccessKeys or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventgrid.models.TopicSharedAccessKeys] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicSharedAccessKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -807,27 +1107,21 @@ def begin_regenerate_key( resource_group_name=resource_group_name, topic_name=topic_name, regenerate_key_request=regenerate_key_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('TopicSharedAccessKeys', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'topicName': self._serialize.url("topic_name", topic_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -839,8 +1133,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey'} # type: ignore + @distributed_trace def list_event_types( self, resource_group_name, # type: str @@ -863,7 +1159,8 @@ def list_event_types( :param resource_name: Name of the topic. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EventTypesListResult or the result of cls(response) + :return: An iterator like instance of either EventTypesListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventgrid.models.EventTypesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -872,38 +1169,37 @@ def list_event_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_event_types.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'providerNamespace': self._serialize.url("provider_namespace", provider_namespace, 'str'), - 'resourceTypeName': self._serialize.url("resource_type_name", resource_type_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + template_url=self.list_event_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_event_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_namespace=provider_namespace, + resource_type_name=resource_type_name, + resource_name=resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EventTypesListResult', pipeline_response) + deserialized = self._deserialize("EventTypesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -921,6 +1217,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py index 8baaf57b05ea..edbf40d3a78a 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py +++ b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py @@ -83,7 +83,7 @@ install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', - 'azure-mgmt-core>=1.2.0,<2.0.0', + 'azure-mgmt-core>=1.3.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml index ee035fbb94ef..7b5b33125e6e 100644 --- a/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml +++ b/sdk/eventgrid/azure-mgmt-eventgrid/tests/recordings/test_domain.test_domain.yaml @@ -13,7 +13,8 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: @@ -21,7 +22,7 @@ interactions: string: '{"properties":{"provisioningState":"Creating","endpoint":null},"location":"eastus2euap","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' headers: azure-asyncoperation: - - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/E1494F88-F72F-4C15-BB6D-851719C75927?api-version=2021-12-01 + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/EB8BA8FA-3B2E-4737-AB3B-67BC3400DAB1?api-version=2021-12-01 cache-control: - no-cache content-length: @@ -29,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:33:46 GMT + - Sat, 11 Dec 2021 01:05:53 GMT expires: - '-1' pragma: @@ -41,7 +42,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 201 message: Created @@ -55,12 +56,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/E1494F88-F72F-4C15-BB6D-851719C75927?api-version=2021-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/EB8BA8FA-3B2E-4737-AB3B-67BC3400DAB1?api-version=2021-12-01 response: body: - string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/E1494F88-F72F-4C15-BB6D-851719C75927?api-version=2021-12-01","name":"e1494f88-f72f-4c15-bb6d-851719c75927","status":"Succeeded"}' + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/EB8BA8FA-3B2E-4737-AB3B-67BC3400DAB1?api-version=2021-12-01","name":"eb8ba8fa-3b2e-4737-ab3b-67bc3400dab1","status":"Succeeded"}' headers: cache-control: - no-cache @@ -69,7 +71,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:33:57 GMT + - Sat, 11 Dec 2021 01:06:03 GMT expires: - '-1' pragma: @@ -97,12 +99,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: body: - string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"7cd50d1d-c7d6-4061-b6a5-594fed35abb7","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"d399cb3d-c345-41e5-9275-d97e66188253","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' headers: cache-control: - no-cache @@ -111,7 +114,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:33:57 GMT + - Sat, 11 Dec 2021 01:06:03 GMT expires: - '-1' pragma: @@ -143,15 +146,16 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: body: - string: '{"properties":{"provisioningState":"Updating","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"7cd50d1d-c7d6-4061-b6a5-594fed35abb7","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + string: '{"properties":{"provisioningState":"Updating","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"d399cb3d-c345-41e5-9275-d97e66188253","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' headers: azure-asyncoperation: - - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/67211BD5-E97D-457F-A548-D3FCA3E877DB?api-version=2021-12-01 + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/73C7C6F1-C4EE-4DF6-9AD3-7712BC311D77?api-version=2021-12-01 cache-control: - no-cache content-length: @@ -159,7 +163,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:34:01 GMT + - Sat, 11 Dec 2021 01:06:05 GMT expires: - '-1' pragma: @@ -171,7 +175,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1198' status: code: 201 message: Created @@ -185,12 +189,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/67211BD5-E97D-457F-A548-D3FCA3E877DB?api-version=2021-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/73C7C6F1-C4EE-4DF6-9AD3-7712BC311D77?api-version=2021-12-01 response: body: - string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/67211BD5-E97D-457F-A548-D3FCA3E877DB?api-version=2021-12-01","name":"67211bd5-e97d-457f-a548-d3fca3e877db","status":"Succeeded"}' + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/73C7C6F1-C4EE-4DF6-9AD3-7712BC311D77?api-version=2021-12-01","name":"73c7c6f1-c4ee-4df6-9ad3-7712bc311d77","status":"Succeeded"}' headers: cache-control: - no-cache @@ -199,7 +204,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:34:11 GMT + - Sat, 11 Dec 2021 01:06:15 GMT expires: - '-1' pragma: @@ -227,12 +232,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: body: - string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"7cd50d1d-c7d6-4061-b6a5-594fed35abb7","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"d399cb3d-c345-41e5-9275-d97e66188253","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' headers: cache-control: - no-cache @@ -241,7 +247,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:34:12 GMT + - Sat, 11 Dec 2021 01:06:15 GMT expires: - '-1' pragma: @@ -269,12 +275,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: body: - string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"7cd50d1d-c7d6-4061-b6a5-594fed35abb7","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' + string: '{"properties":{"provisioningState":"Succeeded","endpoint":"https://domain70eb095d.eastus2euap-1.eventgrid.azure.net/api/events","inputSchema":"EventGridSchema","metricResourceId":"d399cb3d-c345-41e5-9275-d97e66188253","publicNetworkAccess":"Enabled"},"location":"eastus2euap","tags":{"tag1":"value1","tag2":"value2"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d","name":"domain70eb095d","type":"Microsoft.EventGrid/domains"}' headers: cache-control: - no-cache @@ -283,7 +290,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:34:12 GMT + - Sat, 11 Dec 2021 01:06:15 GMT expires: - '-1' pragma: @@ -313,7 +320,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.EventGrid/domains/domain70eb095d?api-version=2021-12-01 response: @@ -321,17 +329,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/2A715E2F-13FA-42C5-8671-EE162FE2DBB1?api-version=2021-12-01 + - https://management.azure.com:443/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/25EE31CE-3F24-48FB-856B-13AD3C5475DC?api-version=2021-12-01 cache-control: - no-cache content-length: - '0' date: - - Fri, 05 Nov 2021 06:34:13 GMT + - Sat, 11 Dec 2021 01:06:15 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationResults/2A715E2F-13FA-42C5-8671-EE162FE2DBB1?api-version=2021-12-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationResults/25EE31CE-3F24-48FB-856B-13AD3C5475DC?api-version=2021-12-01 pragma: - no-cache server: @@ -355,12 +363,13 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-eventgrid/10.0.0 Python/3.6.9 (Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-eventgrid/0.0.0 Python/3.8.12 (Linux-5.11.0-1021-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/2A715E2F-13FA-42C5-8671-EE162FE2DBB1?api-version=2021-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/25EE31CE-3F24-48FB-856B-13AD3C5475DC?api-version=2021-12-01 response: body: - string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/2A715E2F-13FA-42C5-8671-EE162FE2DBB1?api-version=2021-12-01","name":"2a715e2f-13fa-42c5-8671-ee162fe2dbb1","status":"Succeeded"}' + string: '{"id":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.EventGrid/locations/eastus2euap/operationsStatus/25EE31CE-3F24-48FB-856B-13AD3C5475DC?api-version=2021-12-01","name":"25ee31ce-3f24-48fb-856b-13ad3c5475dc","status":"Succeeded"}' headers: cache-control: - no-cache @@ -369,7 +378,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 05 Nov 2021 06:34:24 GMT + - Sat, 11 Dec 2021 01:06:26 GMT expires: - '-1' pragma: diff --git a/shared_requirements.txt b/shared_requirements.txt index a678aae45de0..685e958733ee 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -222,6 +222,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mixedreality-remoterendering azure-core<2.0.0,>=1.6.0 #override azure-mixedreality-remoterendering azure-mixedreality-authentication>=1.0.0b1 #override azure-ai-language-conversations azure-core<2.0.0,>=1.19.1 +#override azure-mgmt-eventgrid msrest>=0.6.21 +#override azure-mgmt-eventgrid azure-mgmt-core>=1.3.0,<2.0.0 #override azure-ai-language-conversations msrest>=0.6.21 #override azure-mgmt-deviceupdate msrest>=0.6.21 #override azure-mgmt-dataprotection msrest>=0.6.21 @@ -230,4 +232,3 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-desktopvirtualization msrest>=0.6.21 #override azure-mgmt-monitor msrest>=0.6.21 #override azure-mgmt-applicationinsights msrest>=0.6.21 -