From e964a68b88abb1b4abc92de1e9eef5f833c4a015 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Feb 2022 09:18:12 +0000 Subject: [PATCH] CodeGen from PR 17827 in Azure/azure-rest-api-specs Merge 6298506a310492065a6a2db33e5f34b7515800fd into 0229905ebb1e140b68ce2f4b90ef185dea0f79ad --- sdk/webpubsub/azure-mgmt-webpubsub/_meta.json | 10 +- .../azure/mgmt/webpubsub/__init__.py | 9 +- .../azure/mgmt/webpubsub/_configuration.py | 19 +- .../azure/mgmt/webpubsub/_metadata.json | 21 +- .../azure/mgmt/webpubsub/_patch.py | 31 + .../azure/mgmt/webpubsub/_vendor.py | 27 + .../azure/mgmt/webpubsub/_version.py | 2 +- .../_web_pub_sub_management_client.py | 122 +- .../azure/mgmt/webpubsub/aio/__init__.py | 5 + .../mgmt/webpubsub/aio/_configuration.py | 6 +- .../azure/mgmt/webpubsub/aio/_patch.py | 31 + .../aio/_web_pub_sub_management_client.py | 110 +- .../webpubsub/aio/operations/_operations.py | 44 +- .../aio/operations/_usages_operations.py | 61 +- .../_web_pub_sub_hubs_operations.py | 225 +- .../aio/operations/_web_pub_sub_operations.py | 571 +++-- ...private_endpoint_connections_operations.py | 200 +- ...b_sub_private_link_resources_operations.py | 64 +- ...hared_private_link_resources_operations.py | 234 +-- .../azure/mgmt/webpubsub/models/__init__.py | 165 +- .../azure/mgmt/webpubsub/models/_models.py | 1847 ----------------- .../mgmt/webpubsub/models/_models_py3.py | 997 ++++++--- .../_web_pub_sub_management_client_enums.py | 54 +- .../mgmt/webpubsub/operations/_operations.py | 85 +- .../operations/_usages_operations.py | 109 +- .../_web_pub_sub_hubs_operations.py | 460 ++-- .../operations/_web_pub_sub_operations.py | 1140 ++++++---- ...private_endpoint_connections_operations.py | 422 ++-- ...b_sub_private_link_resources_operations.py | 116 +- ...hared_private_link_resources_operations.py | 466 +++-- 30 files changed, 3456 insertions(+), 4197 deletions(-) create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_patch.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_vendor.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_patch.py delete mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json b/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json index 9d70c84fc90a..263b02926dc7 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json +++ b/sdk/webpubsub/azure-mgmt-webpubsub/_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": "f6de239922d6b23e97750ca3f508ac55c1d2f235", + "commit": "46ad97970c9c2050396de6d1d0f586166b8d0417", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/webpubsub/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/webpubsub/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/webpubsub/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py index ebf0402927b3..fd83a583b2c0 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['WebPubSubManagementClient'] -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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py index d649cad096a9..d5391dbb6783 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class WebPubSubManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(WebPubSubManagementClientConfiguration, 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(WebPubSubManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json index 10de52fcd1df..b0065a82afb5 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json @@ -5,13 +5,13 @@ "name": "WebPubSubManagementClient", "filename": "_web_pub_sub_management_client", "description": "REST API for Azure WebPubSub Service.", - "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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"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": { "operations": "Operations", diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_patch.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_vendor.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py index c47f66669f1b..eae7c95b6fbd 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "0.1.0" diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py index 3bf621bf3149..368ebace7ae9 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import WebPubSubManagementClientConfiguration +from .operations import Operations, UsagesOperations, WebPubSubHubsOperations, WebPubSubOperations, WebPubSubPrivateEndpointConnectionsOperations, WebPubSubPrivateLinkResourcesOperations, WebPubSubSharedPrivateLinkResourcesOperations + 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 WebPubSubManagementClientConfiguration -from .operations import Operations -from .operations import WebPubSubOperations -from .operations import UsagesOperations -from .operations import WebPubSubHubsOperations -from .operations import WebPubSubPrivateEndpointConnectionsOperations -from .operations import WebPubSubPrivateLinkResourcesOperations -from .operations import WebPubSubSharedPrivateLinkResourcesOperations -from . import models - -class WebPubSubManagementClient(object): +class WebPubSubManagementClient: """REST API for Azure WebPubSub Service. :ivar operations: Operations operations @@ -40,70 +32,76 @@ class WebPubSubManagementClient(object): :vartype usages: azure.mgmt.webpubsub.operations.UsagesOperations :ivar web_pub_sub_hubs: WebPubSubHubsOperations operations :vartype web_pub_sub_hubs: azure.mgmt.webpubsub.operations.WebPubSubHubsOperations - :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations operations - :vartype web_pub_sub_private_endpoint_connections: azure.mgmt.webpubsub.operations.WebPubSubPrivateEndpointConnectionsOperations + :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations + operations + :vartype web_pub_sub_private_endpoint_connections: + azure.mgmt.webpubsub.operations.WebPubSubPrivateEndpointConnectionsOperations :ivar web_pub_sub_private_link_resources: WebPubSubPrivateLinkResourcesOperations operations - :vartype web_pub_sub_private_link_resources: azure.mgmt.webpubsub.operations.WebPubSubPrivateLinkResourcesOperations - :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations - :vartype web_pub_sub_shared_private_link_resources: azure.mgmt.webpubsub.operations.WebPubSubSharedPrivateLinkResourcesOperations + :vartype web_pub_sub_private_link_resources: + azure.mgmt.webpubsub.operations.WebPubSubPrivateLinkResourcesOperations + :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations + operations + :vartype web_pub_sub_shared_private_link_resources: + azure.mgmt.webpubsub.operations.WebPubSubSharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription Id which uniquely identify the 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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = WebPubSubManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = WebPubSubManagementClientConfiguration(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._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub = WebPubSubOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_hubs = WebPubSubHubsOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub = WebPubSubOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_hubs = WebPubSubHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> 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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py index c18824563ccf..6e2cf5bc178d 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py @@ -8,3 +8,8 @@ from ._web_pub_sub_management_client import WebPubSubManagementClient __all__ = ['WebPubSubManagementClient'] + +# `._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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py index dddb1c70eabc..ae4d3e546292 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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(WebPubSubManagementClientConfiguration, 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(WebPubSubManagementClientConfiguration, 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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_patch.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py index e303dd3ca7cc..36e77bc5a727 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py @@ -6,28 +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 WebPubSubManagementClientConfiguration +from .operations import Operations, UsagesOperations, WebPubSubHubsOperations, WebPubSubOperations, WebPubSubPrivateEndpointConnectionsOperations, WebPubSubPrivateLinkResourcesOperations, WebPubSubSharedPrivateLinkResourcesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import WebPubSubManagementClientConfiguration -from .operations import Operations -from .operations import WebPubSubOperations -from .operations import UsagesOperations -from .operations import WebPubSubHubsOperations -from .operations import WebPubSubPrivateEndpointConnectionsOperations -from .operations import WebPubSubPrivateLinkResourcesOperations -from .operations import WebPubSubSharedPrivateLinkResourcesOperations -from .. import models - - -class WebPubSubManagementClient(object): +class WebPubSubManagementClient: """REST API for Azure WebPubSub Service. :ivar operations: Operations operations @@ -38,68 +32,76 @@ class WebPubSubManagementClient(object): :vartype usages: azure.mgmt.webpubsub.aio.operations.UsagesOperations :ivar web_pub_sub_hubs: WebPubSubHubsOperations operations :vartype web_pub_sub_hubs: azure.mgmt.webpubsub.aio.operations.WebPubSubHubsOperations - :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations operations - :vartype web_pub_sub_private_endpoint_connections: azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateEndpointConnectionsOperations + :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations + operations + :vartype web_pub_sub_private_endpoint_connections: + azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateEndpointConnectionsOperations :ivar web_pub_sub_private_link_resources: WebPubSubPrivateLinkResourcesOperations operations - :vartype web_pub_sub_private_link_resources: azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateLinkResourcesOperations - :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations - :vartype web_pub_sub_shared_private_link_resources: azure.mgmt.webpubsub.aio.operations.WebPubSubSharedPrivateLinkResourcesOperations + :vartype web_pub_sub_private_link_resources: + azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateLinkResourcesOperations + :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations + operations + :vartype web_pub_sub_shared_private_link_resources: + azure.mgmt.webpubsub.aio.operations.WebPubSubSharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription Id which uniquely identify the 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 = WebPubSubManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = WebPubSubManagementClientConfiguration(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub = WebPubSubOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_hubs = WebPubSubHubsOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub = WebPubSubOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_hubs = WebPubSubHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( - 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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py index c5ce47e6815f..951b554b6e58 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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 @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +96,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py index 44e0da7c1aa6..9d779964ca77 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_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._usages_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, location: str, @@ -51,8 +57,10 @@ def list( :param location: the location like "eastus". :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SignalRServiceUsageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SignalRServiceUsageList] + :return: An iterator like instance of either SignalRServiceUsageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SignalRServiceUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRServiceUsageList"] @@ -60,35 +68,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # 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_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.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_request( + location=location, + subscription_id=self._config.subscription_id, + 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('SignalRServiceUsageList', pipeline_response) + deserialized = self._deserialize("SignalRServiceUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +105,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_hubs_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_hubs_operations.py index 515e4ef793df..32a79c1efbd6 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_hubs_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_hubs_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._web_pub_sub_hubs_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_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 def list( self, resource_group_name: str, @@ -66,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('WebPubSubHubList', pipeline_response) + deserialized = self._deserialize("WebPubSubHubList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +111,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs'} # type: ignore + @distributed_trace_async async def get( self, hub_name: str, @@ -145,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubHub', pipeline_response) @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + async def _create_or_update_initial( self, hub_name: str, @@ -196,40 +193,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'WebPubSubHub') - # 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( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'WebPubSubHub') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WebPubSubHub', pipeline_response) @@ -241,8 +227,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.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, hub_name: str, @@ -264,15 +253,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubHub :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 WebPubSubHub 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 WebPubSubHub or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubHub] - :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.WebPubSubHub"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +278,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubHub', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -318,6 +304,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.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore async def _delete_initial( @@ -332,41 +319,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, hub_name: str, @@ -385,15 +363,17 @@ async def begin_delete( :type resource_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', @@ -408,22 +388,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 = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -435,4 +407,5 @@ 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.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py index 7d02073a2d8e..dbc63fbe67c4 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_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._web_pub_sub_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, build_list_skus_request, build_regenerate_key_request_initial, build_restart_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 check_name_availability( self, location: str, @@ -65,37 +71,27 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # 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(parameters, 'NameAvailabilityParameters') - # 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_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailability', pipeline_response) @@ -104,8 +100,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -113,8 +112,10 @@ def list_by_subscription( """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :return: An iterator like instance of either WebPubSubResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] @@ -122,34 +123,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + 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, + 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('WebPubSubResourceList', pipeline_response) + deserialized = self._deserialize("WebPubSubResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -162,17 +158,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -184,8 +182,10 @@ def list_by_resource_group( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :return: An iterator like instance of either WebPubSubResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] @@ -193,35 +193,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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') - - 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, + 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, + 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('WebPubSubResourceList', pipeline_response) + deserialized = self._deserialize("WebPubSubResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -234,17 +230,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -268,33 +266,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') - # 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, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubResource', pipeline_response) @@ -303,8 +291,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -317,39 +307,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'WebPubSubResource') - # 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, + resource_name=resource_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(parameters, 'WebPubSubResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -362,8 +341,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.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -382,15 +364,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource :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 WebPubSubResource 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 WebPubSubResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] - :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.WebPubSubResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,27 +388,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubResource', 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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -434,6 +414,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.SignalRService/webPubSub/{resourceName}'} # type: ignore async def _delete_initial( @@ -447,40 +428,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # 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'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -496,15 +468,17 @@ async def begin_delete( :type resource_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', @@ -518,21 +492,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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -544,6 +511,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.SignalRService/webPubSub/{resourceName}'} # type: ignore async def _update_initial( @@ -558,39 +526,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + 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(parameters, 'WebPubSubResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'WebPubSubResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -600,8 +557,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -620,15 +580,19 @@ async def begin_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource :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 WebPubSubResource 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 WebPubSubResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] - :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.WebPubSubResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,27 +604,21 @@ async def begin_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubResource', 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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -672,8 +630,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.SignalRService/webPubSub/{resourceName}'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -697,33 +657,23 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.list_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'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubKeys', pipeline_response) @@ -732,8 +682,10 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys'} # type: ignore + async def _regenerate_key_initial( self, resource_group_name: str, @@ -746,39 +698,28 @@ async def _regenerate_key_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + 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(parameters, 'RegenerateKeyParameters') + + request = build_regenerate_key_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'RegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubKeys', pipeline_response) @@ -786,8 +727,11 @@ async def _regenerate_key_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def begin_regenerate_key( self, resource_group_name: str, @@ -807,15 +751,19 @@ async def begin_regenerate_key( :type parameters: ~azure.mgmt.webpubsub.models.RegenerateKeyParameters :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 WebPubSubKeys 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 WebPubSubKeys or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubKeys] - :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.WebPubSubKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -827,27 +775,21 @@ async def begin_regenerate_key( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubKeys', 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -859,6 +801,7 @@ 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.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore async def _restart_initial( @@ -872,40 +815,31 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._restart_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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self._restart_initial.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 if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -921,15 +855,17 @@ async def begin_restart( :type resource_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', @@ -943,21 +879,14 @@ async def begin_restart( 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -969,8 +898,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + @distributed_trace_async async def list_skus( self, resource_group_name: str, @@ -994,33 +925,23 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.list_skus.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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_skus.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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SkuList', pipeline_response) @@ -1029,4 +950,6 @@ async def list_skus( return cls(pipeline_response, deserialized, {}) return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/skus'} # type: ignore + diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py index 63f60dda479c..2dde2193ff03 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_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._web_pub_sub_private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_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 def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param resource_name: The name of the resource. :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 PrivateEndpointConnectionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, private_endpoint_connection_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -181,8 +178,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def update( self, private_endpoint_connection_name: str, @@ -212,39 +212,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') - # 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( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -253,8 +243,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_initial( self, private_endpoint_connection_name: str, @@ -267,41 +259,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, private_endpoint_connection_name: str, @@ -320,15 +303,17 @@ async def begin_delete( :type resource_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', @@ -343,22 +328,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 = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -370,4 +347,5 @@ 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.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py index 605739884249..87688fa7f8b3 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_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._web_pub_sub_private_link_resources_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, resource_group_name: str, @@ -55,8 +61,10 @@ def list( :param resource_name: The name of the resource. :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 PrivateLinkResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateLinkResourceList] + :return: An iterator like instance of either PrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceList"] @@ -64,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +111,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py index 6329ad2173ff..d83e30c9c3a2 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_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._web_pub_sub_shared_private_link_resources_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_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 def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param resource_name: The name of the resource. :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 SharedPrivateLinkResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('SharedPrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("SharedPrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, shared_private_link_resource_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) @@ -181,8 +178,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + async def _create_or_update_initial( self, shared_private_link_resource_name: str, @@ -196,40 +195,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SharedPrivateLinkResource') - # 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( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'SharedPrivateLinkResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) @@ -241,8 +229,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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, shared_private_link_resource_name: str, @@ -264,15 +255,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource :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 SharedPrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :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.SharedPrivateLinkResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +281,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('SharedPrivateLinkResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -318,6 +307,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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore async def _delete_initial( @@ -332,41 +322,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, shared_private_link_resource_name: str, @@ -385,15 +366,17 @@ async def begin_delete( :type resource_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', @@ -408,22 +391,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 = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -435,4 +410,5 @@ 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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py index 5ee551146124..754933de43ab 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py @@ -6,116 +6,61 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Dimension - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import EventHandler - from ._models_py3 import LiveTraceCategory - from ._models_py3 import LiveTraceConfiguration - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentity - from ._models_py3 import ManagedIdentitySettings - from ._models_py3 import MetricSpecification - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetworkACL - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import OperationProperties - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointACL - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionList - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceList - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateKeyParameters - from ._models_py3 import Resource - from ._models_py3 import ResourceLogCategory - from ._models_py3 import ResourceLogConfiguration - from ._models_py3 import ResourceSku - from ._models_py3 import ServiceSpecification - from ._models_py3 import ShareablePrivateLinkResourceProperties - from ._models_py3 import ShareablePrivateLinkResourceType - from ._models_py3 import SharedPrivateLinkResource - from ._models_py3 import SharedPrivateLinkResourceList - from ._models_py3 import SignalRServiceUsage - from ._models_py3 import SignalRServiceUsageList - from ._models_py3 import SignalRServiceUsageName - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import SkuList - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import UpstreamAuthSettings - from ._models_py3 import UserAssignedIdentityProperty - from ._models_py3 import WebPubSubHub - from ._models_py3 import WebPubSubHubList - from ._models_py3 import WebPubSubHubProperties - from ._models_py3 import WebPubSubKeys - from ._models_py3 import WebPubSubNetworkACLs - from ._models_py3 import WebPubSubResource - from ._models_py3 import WebPubSubResourceList - from ._models_py3 import WebPubSubTlsSettings -except (SyntaxError, ImportError): - from ._models import Dimension # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import EventHandler # type: ignore - from ._models import LiveTraceCategory # type: ignore - from ._models import LiveTraceConfiguration # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentity # type: ignore - from ._models import ManagedIdentitySettings # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkACL # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointACL # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionList # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceList # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateKeyParameters # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceLogCategory # type: ignore - from ._models import ResourceLogConfiguration # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import ShareablePrivateLinkResourceProperties # type: ignore - from ._models import ShareablePrivateLinkResourceType # type: ignore - from ._models import SharedPrivateLinkResource # type: ignore - from ._models import SharedPrivateLinkResourceList # type: ignore - from ._models import SignalRServiceUsage # type: ignore - from ._models import SignalRServiceUsageList # type: ignore - from ._models import SignalRServiceUsageName # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SkuList # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpstreamAuthSettings # type: ignore - from ._models import UserAssignedIdentityProperty # type: ignore - from ._models import WebPubSubHub # type: ignore - from ._models import WebPubSubHubList # type: ignore - from ._models import WebPubSubHubProperties # type: ignore - from ._models import WebPubSubKeys # type: ignore - from ._models import WebPubSubNetworkACLs # type: ignore - from ._models import WebPubSubResource # type: ignore - from ._models import WebPubSubResourceList # type: ignore - from ._models import WebPubSubTlsSettings # type: ignore +from ._models_py3 import Dimension +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import EventHandler +from ._models_py3 import LiveTraceCategory +from ._models_py3 import LiveTraceConfiguration +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentity +from ._models_py3 import ManagedIdentitySettings +from ._models_py3 import MetricSpecification +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetworkACL +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import OperationProperties +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointACL +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionList +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceList +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateKeyParameters +from ._models_py3 import Resource +from ._models_py3 import ResourceLogCategory +from ._models_py3 import ResourceLogConfiguration +from ._models_py3 import ResourceSku +from ._models_py3 import ServiceSpecification +from ._models_py3 import ShareablePrivateLinkResourceProperties +from ._models_py3 import ShareablePrivateLinkResourceType +from ._models_py3 import SharedPrivateLinkResource +from ._models_py3 import SharedPrivateLinkResourceList +from ._models_py3 import SignalRServiceUsage +from ._models_py3 import SignalRServiceUsageList +from ._models_py3 import SignalRServiceUsageName +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuList +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UpstreamAuthSettings +from ._models_py3 import UserAssignedIdentityProperty +from ._models_py3 import WebPubSubHub +from ._models_py3 import WebPubSubHubList +from ._models_py3 import WebPubSubHubProperties +from ._models_py3 import WebPubSubKeys +from ._models_py3 import WebPubSubNetworkACLs +from ._models_py3 import WebPubSubResource +from ._models_py3 import WebPubSubResourceList +from ._models_py3 import WebPubSubTlsSettings + from ._web_pub_sub_management_client_enums import ( ACLAction, diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py deleted file mode 100644 index 94b32a08f4b2..000000000000 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py +++ /dev/null @@ -1,1847 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Dimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. - - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.internal_name = kwargs.get('internal_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.webpubsub.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.webpubsub.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.webpubsub.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class EventHandler(msrest.serialization.Model): - """Properties of event handler. - - All required parameters must be populated in order to send to Azure. - - :param url_template: Required. Gets or sets the EventHandler URL template. You can use a - predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL - is dynamically calculated when the client request comes in. - For example, UrlTemplate can be ``http://example.com/api/{hub}/{event}``. The host part can't - contains parameters. - :type url_template: str - :param user_event_pattern: Gets or sets the matching pattern for event names. - There are 3 kind of patterns supported: - - .. code-block:: - - 1. "*", it to matches any event name - 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" - and "event2" - 3. The single event name, for example, "event1", it matches "event1". - :type user_event_pattern: str - :param system_events: Gets ot sets the list of system events. - :type system_events: list[str] - :param auth: Gets or sets the auth settings for an event handler. If not set, no auth is used. - :type auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings - """ - - _validation = { - 'url_template': {'required': True}, - } - - _attribute_map = { - 'url_template': {'key': 'urlTemplate', 'type': 'str'}, - 'user_event_pattern': {'key': 'userEventPattern', 'type': 'str'}, - 'system_events': {'key': 'systemEvents', 'type': '[str]'}, - 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(EventHandler, self).__init__(**kwargs) - self.url_template = kwargs['url_template'] - self.user_event_pattern = kwargs.get('user_event_pattern', None) - self.system_events = kwargs.get('system_events', None) - self.auth = kwargs.get('auth', None) - - -class LiveTraceCategory(msrest.serialization.Model): - """Live trace category configuration of a Microsoft.SignalRService resource. - - :param name: Gets or sets the live trace category's name. - Available values: ConnectivityLogs, MessagingLogs. - Case insensitive. - :type name: str - :param enabled: Indicates whether or the live trace category is enabled. - Available values: true, false. - Case insensitive. - :type enabled: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveTraceCategory, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.enabled = kwargs.get('enabled', None) - - -class LiveTraceConfiguration(msrest.serialization.Model): - """Live trace configuration of a Microsoft.SignalRService resource. - - :param enabled: Indicates whether or not enable live trace. - When it's set to true, live trace client can connect to the service. - Otherwise, live trace client can't connect to the service, so that you are unable to receive - any log, no matter what you configure in "categories". - Available values: true, false. - Case insensitive. - :type enabled: str - :param categories: Gets or sets the list of category configurations. - :type categories: list[~azure.mgmt.webpubsub.models.LiveTraceCategory] - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'str'}, - 'categories': {'key': 'categories', 'type': '[LiveTraceCategory]'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveTraceConfiguration, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', "false") - self.categories = kwargs.get('categories', None) - - -class LogSpecification(msrest.serialization.Model): - """Specifications of the Logs for Azure Monitoring. - - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class ManagedIdentity(msrest.serialization.Model): - """A class represent managed identities used for request and response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type: Represent the identity type: systemAssigned, userAssigned, None. Possible values - include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType - :param user_assigned_identities: Get or set the user assigned identities. - :type user_assigned_identities: dict[str, - ~azure.mgmt.webpubsub.models.UserAssignedIdentityProperty] - :ivar principal_id: Get the principal id for the system assigned identity. - Only be used in response. - :vartype principal_id: str - :ivar tenant_id: Get the tenant id for the system assigned identity. - Only be used in response. - :vartype tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentityProperty}'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - self.principal_id = None - self.tenant_id = None - - -class ManagedIdentitySettings(msrest.serialization.Model): - """Managed identity settings for upstream. - - :param resource: The Resource indicating the App ID URI of the target resource. - It also appears in the aud (audience) claim of the issued token. - :type resource: str - """ - - _attribute_map = { - 'resource': {'key': 'resource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentitySettings, self).__init__(**kwargs) - self.resource = kwargs.get('resource', None) - - -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :type aggregation_type: str - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - Ex. a metric that returns the number of times a particular error code was emitted. The error - code may not appear - often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~azure.mgmt.webpubsub.models.Dimension] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.dimensions = kwargs.get('dimensions', None) - - -class NameAvailability(msrest.serialization.Model): - """Result of the request to check name availability. It contains a flag and possible reason of failure. - - :param name_available: Indicates whether the name is available or not. - :type name_available: bool - :param reason: The reason of the availability. Required if name is not available. - :type reason: str - :param message: The message of the operation. - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailability, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Data POST-ed to the nameAvailability action. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or - "Microsoft.SignalRService/webPubSub". - :type type: str - :param name: Required. The resource name to validate. e.g."my-resource-name". - :type name: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs['type'] - self.name = kwargs['name'] - - -class NetworkACL(msrest.serialization.Model): - """Network ACL. - - :param allow: Allowed request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - """ - - _attribute_map = { - 'allow': {'key': 'allow', 'type': '[str]'}, - 'deny': {'key': 'deny', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkACL, self).__init__(**kwargs) - self.allow = kwargs.get('allow', None) - self.deny = kwargs.get('deny', None) - - -class Operation(msrest.serialization.Model): - """REST API operation supported by resource provider. - - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: If the operation is a data action. (for data plane rbac). - :type is_data_action: bool - :param display: The object that describes the operation. - :type display: ~azure.mgmt.webpubsub.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~azure.mgmt.webpubsub.models.OperationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes a operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationList(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations. - - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.webpubsub.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: The service specifications. - :type service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """Private endpoint. - - :param id: Full qualified Id of the private endpoint. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointACL(NetworkACL): - """ACL for a private endpoint. - - All required parameters must be populated in order to send to Azure. - - :param allow: Allowed request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param name: Required. Name of the private endpoint connection. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'allow': {'key': 'allow', 'type': '[str]'}, - 'deny': {'key': 'deny', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointACL, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection to an azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", - "Updating", "Deleting", "Moving". - :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState - :param private_endpoint: Private endpoint associated with the private endpoint connection. - :type private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint - :ivar group_ids: Group IDs. - :vartype group_ids: list[str] - :param private_link_service_connection_state: Connection state. - :type private_link_service_connection_state: - ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'group_ids': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.system_data = None - self.provisioning_state = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.group_ids = None - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - - -class PrivateEndpointConnectionList(msrest.serialization.Model): - """A list of private endpoint connections. - - :param value: The list of the private endpoint connections. - :type value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] - :param next_link: Request URL that can be used to query next page of private endpoint - connections. Returned when the total number of requested private endpoint connections exceed - maximum page size. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(ProxyResource): - """Private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :param group_id: Group Id of the private link resource. - :type group_id: str - :param required_members: Required members of the private link resource. - :type required_members: list[str] - :param required_zone_names: Required private DNS zone names. - :type required_zone_names: list[str] - :param shareable_private_link_resource_types: The list of resources that are onboarded to - private link service. - :type shareable_private_link_resource_types: - list[~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceType] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - 'shareable_private_link_resource_types': {'key': 'properties.shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - self.shareable_private_link_resource_types = kwargs.get('shareable_private_link_resource_types', None) - - -class PrivateLinkResourceList(msrest.serialization.Model): - """Contains a list of PrivateLinkResource and a possible link to query more results. - - :param value: List of PrivateLinkResource. - :type value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """Connection state of the private endpoint connection. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class RegenerateKeyParameters(msrest.serialization.Model): - """Parameters describes the request to regenerate access keys. - - :param key_type: The keyType to regenerate. Must be either 'primary' or - 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary", "Salt". - :type key_type: str or ~azure.mgmt.webpubsub.models.KeyType - """ - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegenerateKeyParameters, self).__init__(**kwargs) - self.key_type = kwargs.get('key_type', None) - - -class ResourceLogCategory(msrest.serialization.Model): - """Resource log category configuration of a Microsoft.SignalRService resource. - - :param name: Gets or sets the resource log category's name. - Available values: ConnectivityLogs, MessagingLogs. - Case insensitive. - :type name: str - :param enabled: Indicates whether or the resource log category is enabled. - Available values: true, false. - Case insensitive. - :type enabled: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceLogCategory, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.enabled = kwargs.get('enabled', None) - - -class ResourceLogConfiguration(msrest.serialization.Model): - """Resource log configuration of a Microsoft.SignalRService resource. - - :param categories: Gets or sets the list of category configurations. - :type categories: list[~azure.mgmt.webpubsub.models.ResourceLogCategory] - """ - - _attribute_map = { - 'categories': {'key': 'categories', 'type': '[ResourceLogCategory]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceLogConfiguration, self).__init__(**kwargs) - self.categories = kwargs.get('categories', None) - - -class ResourceSku(msrest.serialization.Model): - """The billing information of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. Required. - - Allowed values: Standard_S1, Free_F1. - :type name: str - :param tier: Optional tier of this particular SKU. 'Standard' or 'Free'. - - ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", - "Standard", "Premium". - :type tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier - :ivar size: Not used. Retained for future use. - :vartype size: str - :ivar family: Not used. Retained for future use. - :vartype family: str - :param capacity: Optional, integer. The unit count of the resource. 1 by default. - - If present, following values are allowed: - Free: 1 - Standard: 1,2,5,10,20,50,100. - :type capacity: int - """ - - _validation = { - 'name': {'required': True}, - 'size': {'readonly': True}, - 'family': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = kwargs.get('tier', None) - self.size = None - self.family = None - self.capacity = kwargs.get('capacity', None) - - -class ServiceSpecification(msrest.serialization.Model): - """An object that describes a specification. - - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] - :param log_specifications: Specifications of the Logs for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): - """Describes the properties of a resource type that has been onboarded to private link service. - - :param description: The description of the resource type that has been onboarded to private - link service. - :type description: str - :param group_id: The resource provider group id for the resource that has been onboarded to - private link service. - :type group_id: str - :param type: The resource provider type for the resource that has been onboarded to private - link service. - :type type: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.group_id = kwargs.get('group_id', None) - self.type = kwargs.get('type', None) - - -class ShareablePrivateLinkResourceType(msrest.serialization.Model): - """Describes a resource type that has been onboarded to private link service. - - :param name: The name of the resource type that has been onboarded to private link service. - :type name: str - :param properties: Describes the properties of a resource type that has been onboarded to - private link service. - :type properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - - -class SharedPrivateLinkResource(ProxyResource): - """Describes a Shared Private Link Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :param group_id: The group id from the provider of resource the shared private link resource is - for. - :type group_id: str - :param private_link_resource_id: The resource id of the resource the shared private link - resource is for. - :type private_link_resource_id: str - :ivar provisioning_state: Provisioning state of the shared private link resource. Possible - values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", - "Updating", "Deleting", "Moving". - :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState - :param request_message: The request message for requesting approval of the shared private link - resource. - :type request_message: str - :ivar status: Status of the shared private link resource. Possible values include: "Pending", - "Approved", "Rejected", "Disconnected", "Timeout". - :vartype status: str or ~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedPrivateLinkResource, self).__init__(**kwargs) - self.system_data = None - self.group_id = kwargs.get('group_id', None) - self.private_link_resource_id = kwargs.get('private_link_resource_id', None) - self.provisioning_state = None - self.request_message = kwargs.get('request_message', None) - self.status = None - - -class SharedPrivateLinkResourceList(msrest.serialization.Model): - """A list of shared private link resources. - - :param value: The list of the shared private link resources. - :type value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :param next_link: Request URL that can be used to query next page of private endpoint - connections. Returned when the total number of requested private endpoint connections exceed - maximum page size. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedPrivateLinkResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SignalRServiceUsage(msrest.serialization.Model): - """Object that describes a specific usage of the resources. - - :param id: Fully qualified ARM resource id. - :type id: str - :param current_value: Current value for the usage quota. - :type current_value: long - :param limit: The maximum permitted value for the usage quota. If there is no limit, this value - will be -1. - :type limit: long - :param name: Localizable String object containing the name and a localized value. - :type name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName - :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, - Seconds, Percent, CountPerSecond, BytesPerSecond. - :type unit: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'SignalRServiceUsageName'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRServiceUsage, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.current_value = kwargs.get('current_value', None) - self.limit = kwargs.get('limit', None) - self.name = kwargs.get('name', None) - self.unit = kwargs.get('unit', None) - - -class SignalRServiceUsageList(msrest.serialization.Model): - """Object that includes an array of the resource usages and a possible link for next set. - - :param value: List of the resource usages. - :type value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SignalRServiceUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRServiceUsageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SignalRServiceUsageName(msrest.serialization.Model): - """Localizable String object containing the name and a localized value. - - :param value: The identifier of the usage. - :type value: str - :param localized_value: Localized name of the usage. - :type localized_value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRServiceUsageName, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = kwargs.get('localized_value', None) - - -class Sku(msrest.serialization.Model): - """Describes an available sku.". - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type that this object applies to. - :vartype resource_type: str - :ivar sku: The exact set of keys that define this sku. - :vartype sku: ~azure.mgmt.webpubsub.models.ResourceSku - :ivar capacity: Specifies the unit of the resource. - :vartype capacity: ~azure.mgmt.webpubsub.models.SkuCapacity - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'sku': {'readonly': True}, - 'capacity': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None - - -class SkuCapacity(msrest.serialization.Model): - """Describes scaling information of a sku. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar minimum: The lowest permitted capacity for this resource. - :vartype minimum: int - :ivar maximum: The highest permitted capacity for this resource. - :vartype maximum: int - :ivar default: The default capacity. - :vartype default: int - :ivar allowed_values: Allows capacity value list. - :vartype allowed_values: list[int] - :ivar scale_type: The scale type applicable to the sku. Possible values include: "None", - "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.webpubsub.models.ScaleType - """ - - _validation = { - 'minimum': {'readonly': True}, - 'maximum': {'readonly': True}, - 'default': {'readonly': True}, - 'allowed_values': {'readonly': True}, - 'scale_type': {'readonly': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, - 'allowed_values': {'key': 'allowedValues', 'type': '[int]'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.allowed_values = None - self.scale_type = None - - -class SkuList(msrest.serialization.Model): - """The list skus operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of skus available for the resource. - :vartype value: list[~azure.mgmt.webpubsub.models.Sku] - :ivar next_link: The URL the client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Sku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -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.webpubsub.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 - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.webpubsub.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :param location: The GEO location of the resource. e.g. West US | East US | North Central US | - South Central US. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class UpstreamAuthSettings(msrest.serialization.Model): - """Upstream auth settings. - - :param type: Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible - values include: "None", "ManagedIdentity". - :type type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType - :param managed_identity: Gets or sets the managed identity settings. It's required if the auth - type is set to ManagedIdentity. - :type managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'managed_identity': {'key': 'managedIdentity', 'type': 'ManagedIdentitySettings'}, - } - - def __init__( - self, - **kwargs - ): - super(UpstreamAuthSettings, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.managed_identity = kwargs.get('managed_identity', None) - - -class UserAssignedIdentityProperty(msrest.serialization.Model): - """Properties of user assigned identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Get the principal id for the user assigned identity. - :vartype principal_id: str - :ivar client_id: Get the client id for the user assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedIdentityProperty, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WebPubSubHub(ProxyResource): - """A hub setting. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :param properties: Required. Properties of the hub setting. - :type properties: ~azure.mgmt.webpubsub.models.WebPubSubHubProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'WebPubSubHubProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubHub, self).__init__(**kwargs) - self.system_data = None - self.properties = kwargs['properties'] - - -class WebPubSubHubList(msrest.serialization.Model): - """Hub setting list. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of hub settings to this resource. - :type value: list[~azure.mgmt.webpubsub.models.WebPubSubHub] - :ivar next_link: The URL the client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WebPubSubHub]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubHubList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class WebPubSubHubProperties(msrest.serialization.Model): - """Properties of a hub. - - :param event_handlers: Event handler of a hub. - :type event_handlers: list[~azure.mgmt.webpubsub.models.EventHandler] - :param anonymous_connect_policy: The settings for configuring if anonymous connections are - allowed for this hub: "allow" or "deny". Default to "deny". - :type anonymous_connect_policy: str - """ - - _attribute_map = { - 'event_handlers': {'key': 'eventHandlers', 'type': '[EventHandler]'}, - 'anonymous_connect_policy': {'key': 'anonymousConnectPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubHubProperties, self).__init__(**kwargs) - self.event_handlers = kwargs.get('event_handlers', None) - self.anonymous_connect_policy = kwargs.get('anonymous_connect_policy', "deny") - - -class WebPubSubKeys(msrest.serialization.Model): - """A class represents the access keys of the resource. - - :param primary_key: The primary access key. - :type primary_key: str - :param secondary_key: The secondary access key. - :type secondary_key: str - :param primary_connection_string: Connection string constructed via the primaryKey. - :type primary_connection_string: str - :param secondary_connection_string: Connection string constructed via the secondaryKey. - :type secondary_connection_string: str - """ - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, - 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubKeys, self).__init__(**kwargs) - self.primary_key = kwargs.get('primary_key', None) - self.secondary_key = kwargs.get('secondary_key', None) - self.primary_connection_string = kwargs.get('primary_connection_string', None) - self.secondary_connection_string = kwargs.get('secondary_connection_string', None) - - -class WebPubSubNetworkACLs(msrest.serialization.Model): - """Network ACLs for the resource. - - :param default_action: Default action when no other rule matches. Possible values include: - "Allow", "Deny". - :type default_action: str or ~azure.mgmt.webpubsub.models.ACLAction - :param public_network: ACL for requests from public network. - :type public_network: ~azure.mgmt.webpubsub.models.NetworkACL - :param private_endpoints: ACLs for requests from private endpoints. - :type private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] - """ - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'public_network': {'key': 'publicNetwork', 'type': 'NetworkACL'}, - 'private_endpoints': {'key': 'privateEndpoints', 'type': '[PrivateEndpointACL]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubNetworkACLs, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', None) - self.public_network = kwargs.get('public_network', None) - self.private_endpoints = kwargs.get('private_endpoints', None) - - -class WebPubSubResource(TrackedResource): - """A class represent a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :param location: The GEO location of the resource. e.g. West US | East US | North Central US | - South Central US. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param sku: The billing information of the resource.(e.g. Free, Standard). - :type sku: ~azure.mgmt.webpubsub.models.ResourceSku - :param identity: The managed identity response. - :type identity: ~azure.mgmt.webpubsub.models.ManagedIdentity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", - "Moving". - :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState - :ivar external_ip: The publicly accessible IP of the resource. - :vartype external_ip: str - :ivar host_name: FQDN of the service instance. - :vartype host_name: str - :ivar public_port: The publicly accessible port of the resource which is designed for - browser/client side usage. - :vartype public_port: int - :ivar server_port: The publicly accessible port of the resource which is designed for customer - server side usage. - :vartype server_port: int - :ivar version: Version of the resource. Probably you need the same or higher version of client - SDKs. - :vartype version: str - :ivar private_endpoint_connections: Private endpoint connections to the resource. - :vartype private_endpoint_connections: - list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] - :ivar shared_private_link_resources: The list of shared private link resources. - :vartype shared_private_link_resources: - list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :param tls: TLS settings. - :type tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings - :ivar host_name_prefix: Deprecated. - :vartype host_name_prefix: str - :param live_trace_configuration: Live trace configuration of a Microsoft.SignalRService - resource. - :type live_trace_configuration: ~azure.mgmt.webpubsub.models.LiveTraceConfiguration - :param resource_log_configuration: Resource log configuration of a Microsoft.SignalRService - resource. - If resourceLogConfiguration isn't null or empty, it will override options - "EnableConnectivityLog" and "EnableMessagingLogs" in features. - Otherwise, use options "EnableConnectivityLog" and "EnableMessagingLogs" in features. - :type resource_log_configuration: ~azure.mgmt.webpubsub.models.ResourceLogConfiguration - :param network_ac_ls: Network ACLs. - :type network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs - :param public_network_access: Enable or disable public network access. Default to "Enabled". - When it's Enabled, network ACLs still apply. - When it's Disabled, public network access is always disabled no matter what you set in network - ACLs. - :type public_network_access: str - :param disable_local_auth: DisableLocalAuth - Enable or disable local auth with AccessKey - When set as true, connection with AccessKey=xxx won't work. - :type disable_local_auth: bool - :param disable_aad_auth: DisableLocalAuth - Enable or disable aad auth - When set as true, connection with AuthType=aad won't work. - :type disable_aad_auth: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'external_ip': {'readonly': True}, - 'host_name': {'readonly': True}, - 'public_port': {'readonly': True}, - 'server_port': {'readonly': True}, - 'version': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'shared_private_link_resources': {'readonly': True}, - 'host_name_prefix': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'public_port': {'key': 'properties.publicPort', 'type': 'int'}, - 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, - 'tls': {'key': 'properties.tls', 'type': 'WebPubSubTlsSettings'}, - 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, - 'live_trace_configuration': {'key': 'properties.liveTraceConfiguration', 'type': 'LiveTraceConfiguration'}, - 'resource_log_configuration': {'key': 'properties.resourceLogConfiguration', 'type': 'ResourceLogConfiguration'}, - 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'WebPubSubNetworkACLs'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, - 'disable_aad_auth': {'key': 'properties.disableAadAuth', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubResource, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.provisioning_state = None - self.external_ip = None - self.host_name = None - self.public_port = None - self.server_port = None - self.version = None - self.private_endpoint_connections = None - self.shared_private_link_resources = None - self.tls = kwargs.get('tls', None) - self.host_name_prefix = None - self.live_trace_configuration = kwargs.get('live_trace_configuration', None) - self.resource_log_configuration = kwargs.get('resource_log_configuration', None) - self.network_ac_ls = kwargs.get('network_ac_ls', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.disable_local_auth = kwargs.get('disable_local_auth', False) - self.disable_aad_auth = kwargs.get('disable_aad_auth', False) - - -class WebPubSubResourceList(msrest.serialization.Model): - """Object that includes an array of resources and a possible link for next set. - - :param value: List of the resources. - :type value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WebPubSubResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WebPubSubTlsSettings(msrest.serialization.Model): - """TLS settings for the resource. - - :param client_cert_enabled: Request client certificate during TLS handshake if enabled. - :type client_cert_enabled: bool - """ - - _attribute_map = { - 'client_cert_enabled': {'key': 'clientCertEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(WebPubSubTlsSettings, self).__init__(**kwargs) - self.client_cert_enabled = kwargs.get('client_cert_enabled', True) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py index 8597ca4899ab..e1ccce7cc4bf 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py @@ -18,15 +18,15 @@ class Dimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be + :ivar name: The public facing name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar internal_name: Name of the dimension as it appears in MDM. + :vartype internal_name: str + :ivar to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -45,6 +45,17 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: The public facing name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword internal_name: Name of the dimension as it appears in MDM. + :paramtype internal_name: str + :keyword to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -77,6 +88,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -119,6 +132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -130,8 +145,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.webpubsub.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.webpubsub.models.ErrorDetail """ _attribute_map = { @@ -144,6 +159,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.webpubsub.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -153,13 +172,13 @@ class EventHandler(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url_template: Required. Gets or sets the EventHandler URL template. You can use a + :ivar url_template: Required. Gets or sets the EventHandler URL template. You can use a predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL is dynamically calculated when the client request comes in. For example, UrlTemplate can be ``http://example.com/api/{hub}/{event}``. The host part can't contains parameters. - :type url_template: str - :param user_event_pattern: Gets or sets the matching pattern for event names. + :vartype url_template: str + :ivar user_event_pattern: Gets or sets the matching pattern for event names. There are 3 kind of patterns supported: .. code-block:: @@ -168,11 +187,11 @@ class EventHandler(msrest.serialization.Model): 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" and "event2" 3. The single event name, for example, "event1", it matches "event1". - :type user_event_pattern: str - :param system_events: Gets ot sets the list of system events. - :type system_events: list[str] - :param auth: Gets or sets the auth settings for an event handler. If not set, no auth is used. - :type auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings + :vartype user_event_pattern: str + :ivar system_events: Gets ot sets the list of system events. + :vartype system_events: list[str] + :ivar auth: Upstream auth settings. If not set, no auth is used for upstream messages. + :vartype auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings """ _validation = { @@ -195,6 +214,28 @@ def __init__( auth: Optional["UpstreamAuthSettings"] = None, **kwargs ): + """ + :keyword url_template: Required. Gets or sets the EventHandler URL template. You can use a + predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL + is dynamically calculated when the client request comes in. + For example, UrlTemplate can be ``http://example.com/api/{hub}/{event}``. The host part can't + contains parameters. + :paramtype url_template: str + :keyword user_event_pattern: Gets or sets the matching pattern for event names. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any event name + 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" + and "event2" + 3. The single event name, for example, "event1", it matches "event1". + :paramtype user_event_pattern: str + :keyword system_events: Gets ot sets the list of system events. + :paramtype system_events: list[str] + :keyword auth: Upstream auth settings. If not set, no auth is used for upstream messages. + :paramtype auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings + """ super(EventHandler, self).__init__(**kwargs) self.url_template = url_template self.user_event_pattern = user_event_pattern @@ -205,14 +246,14 @@ def __init__( class LiveTraceCategory(msrest.serialization.Model): """Live trace category configuration of a Microsoft.SignalRService resource. - :param name: Gets or sets the live trace category's name. + :ivar name: Gets or sets the live trace category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. - :type name: str - :param enabled: Indicates whether or the live trace category is enabled. + :vartype name: str + :ivar enabled: Indicates whether or the live trace category is enabled. Available values: true, false. Case insensitive. - :type enabled: str + :vartype enabled: str """ _attribute_map = { @@ -227,6 +268,16 @@ def __init__( enabled: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets or sets the live trace category's name. + Available values: ConnectivityLogs, MessagingLogs. + Case insensitive. + :paramtype name: str + :keyword enabled: Indicates whether or the live trace category is enabled. + Available values: true, false. + Case insensitive. + :paramtype enabled: str + """ super(LiveTraceCategory, self).__init__(**kwargs) self.name = name self.enabled = enabled @@ -235,15 +286,15 @@ def __init__( class LiveTraceConfiguration(msrest.serialization.Model): """Live trace configuration of a Microsoft.SignalRService resource. - :param enabled: Indicates whether or not enable live trace. + :ivar enabled: Indicates whether or not enable live trace. When it's set to true, live trace client can connect to the service. Otherwise, live trace client can't connect to the service, so that you are unable to receive any log, no matter what you configure in "categories". Available values: true, false. Case insensitive. - :type enabled: str - :param categories: Gets or sets the list of category configurations. - :type categories: list[~azure.mgmt.webpubsub.models.LiveTraceCategory] + :vartype enabled: str + :ivar categories: Gets or sets the list of category configurations. + :vartype categories: list[~azure.mgmt.webpubsub.models.LiveTraceCategory] """ _attribute_map = { @@ -258,6 +309,17 @@ def __init__( categories: Optional[List["LiveTraceCategory"]] = None, **kwargs ): + """ + :keyword enabled: Indicates whether or not enable live trace. + When it's set to true, live trace client can connect to the service. + Otherwise, live trace client can't connect to the service, so that you are unable to receive + any log, no matter what you configure in "categories". + Available values: true, false. + Case insensitive. + :paramtype enabled: str + :keyword categories: Gets or sets the list of category configurations. + :paramtype categories: list[~azure.mgmt.webpubsub.models.LiveTraceCategory] + """ super(LiveTraceConfiguration, self).__init__(**kwargs) self.enabled = enabled self.categories = categories @@ -266,10 +328,10 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Logs for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str """ _attribute_map = { @@ -284,6 +346,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -294,11 +362,11 @@ class ManagedIdentity(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param type: Represent the identity type: systemAssigned, userAssigned, None. Possible values + :ivar type: Represents the identity type: systemAssigned, userAssigned, None. Possible values include: "None", "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType - :param user_assigned_identities: Get or set the user assigned identities. - :type user_assigned_identities: dict[str, + :vartype type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType + :ivar user_assigned_identities: Get or set the user assigned identities. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.webpubsub.models.UserAssignedIdentityProperty] :ivar principal_id: Get the principal id for the system assigned identity. Only be used in response. @@ -327,6 +395,14 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentityProperty"]] = None, **kwargs ): + """ + :keyword type: Represents the identity type: systemAssigned, userAssigned, None. Possible + values include: "None", "SystemAssigned", "UserAssigned". + :paramtype type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType + :keyword user_assigned_identities: Get or set the user assigned identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.webpubsub.models.UserAssignedIdentityProperty] + """ super(ManagedIdentity, self).__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities @@ -337,9 +413,9 @@ def __init__( class ManagedIdentitySettings(msrest.serialization.Model): """Managed identity settings for upstream. - :param resource: The Resource indicating the App ID URI of the target resource. + :ivar resource: The Resource indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued token. - :type resource: str + :vartype resource: str """ _attribute_map = { @@ -352,6 +428,11 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword resource: The Resource indicating the App ID URI of the target resource. + It also appears in the aud (audience) claim of the issued token. + :paramtype resource: str + """ super(ManagedIdentitySettings, self).__init__(**kwargs) self.resource = resource @@ -359,29 +440,29 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: The unit that makes sense for the metric. + :vartype unit: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only + :vartype fill_gap_with_zero: str + :ivar category: The name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~azure.mgmt.webpubsub.models.Dimension] + :vartype category: str + :ivar dimensions: The dimensions of the metrics. + :vartype dimensions: list[~azure.mgmt.webpubsub.models.Dimension] """ _attribute_map = { @@ -408,6 +489,31 @@ def __init__( dimensions: Optional[List["Dimension"]] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: The unit that makes sense for the metric. + :paramtype unit: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was emitted. The error + code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where + nothing was emitted. + :paramtype fill_gap_with_zero: str + :keyword category: The name of the metric category that the metric belongs to. A metric can + only belong to a single category. + :paramtype category: str + :keyword dimensions: The dimensions of the metrics. + :paramtype dimensions: list[~azure.mgmt.webpubsub.models.Dimension] + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -422,12 +528,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Result of the request to check name availability. It contains a flag and possible reason of failure. - :param name_available: Indicates whether the name is available or not. - :type name_available: bool - :param reason: The reason of the availability. Required if name is not available. - :type reason: str - :param message: The message of the operation. - :type message: str + :ivar name_available: Indicates whether the name is available or not. + :vartype name_available: bool + :ivar reason: The reason of the availability. Required if name is not available. + :vartype reason: str + :ivar message: The message of the operation. + :vartype message: str """ _attribute_map = { @@ -444,6 +550,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available or not. + :paramtype name_available: bool + :keyword reason: The reason of the availability. Required if name is not available. + :paramtype reason: str + :keyword message: The message of the operation. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -455,11 +569,11 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + :ivar type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub". - :type type: str - :param name: Required. The resource name to validate. e.g."my-resource-name". - :type name: str + :vartype type: str + :ivar name: Required. The resource name to validate. e.g."my-resource-name". + :vartype name: str """ _validation = { @@ -479,6 +593,13 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + "Microsoft.SignalRService/webPubSub". + :paramtype type: str + :keyword name: Required. The resource name to validate. e.g."my-resource-name". + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -487,12 +608,12 @@ def __init__( class NetworkACL(msrest.serialization.Model): """Network ACL. - :param allow: Allowed request types. The value can be one or more of: ClientConnection, + :ivar allow: Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, + :vartype allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :ivar deny: Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :vartype deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] """ _attribute_map = { @@ -507,6 +628,14 @@ def __init__( deny: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, **kwargs ): + """ + :keyword allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :keyword deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + """ super(NetworkACL, self).__init__(**kwargs) self.allow = allow self.deny = deny @@ -515,17 +644,17 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation supported by resource provider. - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: If the operation is a data action. (for data plane rbac). - :type is_data_action: bool - :param display: The object that describes the operation. - :type display: ~azure.mgmt.webpubsub.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the + :ivar name: Name of the operation with format: {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: If the operation is a data action. (for data plane rbac). + :vartype is_data_action: bool + :ivar display: The object that describes a operation. + :vartype display: ~azure.mgmt.webpubsub.models.OperationDisplay + :ivar origin: Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~azure.mgmt.webpubsub.models.OperationProperties + :vartype origin: str + :ivar properties: Extra Operation properties. + :vartype properties: ~azure.mgmt.webpubsub.models.OperationProperties """ _attribute_map = { @@ -546,6 +675,19 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Name of the operation with format: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword is_data_action: If the operation is a data action. (for data plane rbac). + :paramtype is_data_action: bool + :keyword display: The object that describes a operation. + :paramtype display: ~azure.mgmt.webpubsub.models.OperationDisplay + :keyword origin: Optional. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. + :paramtype origin: str + :keyword properties: Extra Operation properties. + :paramtype properties: ~azure.mgmt.webpubsub.models.OperationProperties + """ super(Operation, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -557,14 +699,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes a operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar operation: The localized friendly name for the operation. + :vartype operation: str + :ivar description: The localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -583,6 +725,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword operation: The localized friendly name for the operation. + :paramtype operation: str + :keyword description: The localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -593,12 +745,11 @@ def __init__( class OperationList(msrest.serialization.Model): """Result of the request to list REST API operations. It contains a list of operations. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.webpubsub.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.webpubsub.models.Operation] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -613,6 +764,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.webpubsub.models.Operation] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(OperationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -621,8 +780,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: The service specifications. - :type service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification + :ivar service_specification: An object that describes a specification. + :vartype service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification """ _attribute_map = { @@ -635,6 +794,10 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: An object that describes a specification. + :paramtype service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -642,8 +805,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """Private endpoint. - :param id: Full qualified Id of the private endpoint. - :type id: str + :ivar id: Full qualified Id of the private endpoint. + :vartype id: str """ _attribute_map = { @@ -656,6 +819,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Full qualified Id of the private endpoint. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -665,14 +832,14 @@ class PrivateEndpointACL(NetworkACL): All required parameters must be populated in order to send to Azure. - :param allow: Allowed request types. The value can be one or more of: ClientConnection, + :ivar allow: Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, + :vartype allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :ivar deny: Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] - :param name: Required. Name of the private endpoint connection. - :type name: str + :vartype deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :ivar name: Required. Name of the private endpoint connection. + :vartype name: str """ _validation = { @@ -693,6 +860,16 @@ def __init__( deny: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, **kwargs ): + """ + :keyword allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :keyword deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :keyword name: Required. Name of the private endpoint connection. + :paramtype name: str + """ super(PrivateEndpointACL, self).__init__(allow=allow, deny=deny, **kwargs) self.name = name @@ -726,6 +903,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -761,6 +940,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -777,16 +958,17 @@ class PrivateEndpointConnection(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", - "Updating", "Deleting", "Moving". + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", + "Moving". :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState - :param private_endpoint: Private endpoint associated with the private endpoint connection. - :type private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint + :ivar private_endpoint: Private endpoint. + :vartype private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint :ivar group_ids: Group IDs. :vartype group_ids: list[str] - :param private_link_service_connection_state: Connection state. - :type private_link_service_connection_state: + :ivar private_link_service_connection_state: Connection state of the private endpoint + connection. + :vartype private_link_service_connection_state: ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionState """ @@ -817,6 +999,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: Private endpoint. + :paramtype private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state of the private endpoint + connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.system_data = None self.provisioning_state = None @@ -828,12 +1018,12 @@ def __init__( class PrivateEndpointConnectionList(msrest.serialization.Model): """A list of private endpoint connections. - :param value: The list of the private endpoint connections. - :type value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] - :param next_link: Request URL that can be used to query next page of private endpoint + :ivar value: The list of the private endpoint connections. + :vartype value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :ivar next_link: Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -848,6 +1038,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of the private endpoint connections. + :paramtype value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :keyword next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :paramtype next_link: str + """ super(PrivateEndpointConnectionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -864,15 +1062,15 @@ class PrivateLinkResource(ProxyResource): :vartype name: str :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". :vartype type: str - :param group_id: Group Id of the private link resource. - :type group_id: str - :param required_members: Required members of the private link resource. - :type required_members: list[str] - :param required_zone_names: Required private DNS zone names. - :type required_zone_names: list[str] - :param shareable_private_link_resource_types: The list of resources that are onboarded to + :ivar group_id: Group Id of the private link resource. + :vartype group_id: str + :ivar required_members: Required members of the private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: Required private DNS zone names. + :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to private link service. - :type shareable_private_link_resource_types: + :vartype shareable_private_link_resource_types: list[~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceType] """ @@ -901,6 +1099,18 @@ def __init__( shareable_private_link_resource_types: Optional[List["ShareablePrivateLinkResourceType"]] = None, **kwargs ): + """ + :keyword group_id: Group Id of the private link resource. + :paramtype group_id: str + :keyword required_members: Required members of the private link resource. + :paramtype required_members: list[str] + :keyword required_zone_names: Required private DNS zone names. + :paramtype required_zone_names: list[str] + :keyword shareable_private_link_resource_types: The list of resources that are onboarded to + private link service. + :paramtype shareable_private_link_resource_types: + list[~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceType] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = group_id self.required_members = required_members @@ -911,12 +1121,11 @@ def __init__( class PrivateLinkResourceList(msrest.serialization.Model): """Contains a list of PrivateLinkResource and a possible link to query more results. - :param value: List of PrivateLinkResource. - :type value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). + :ivar value: List of PrivateLinkResource. + :vartype value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -931,6 +1140,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of PrivateLinkResource. + :paramtype value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(PrivateLinkResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -939,14 +1156,14 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """Connection state of the private endpoint connection. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -963,6 +1180,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected", + "Disconnected". + :paramtype status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -972,9 +1200,9 @@ def __init__( class RegenerateKeyParameters(msrest.serialization.Model): """Parameters describes the request to regenerate access keys. - :param key_type: The keyType to regenerate. Must be either 'primary' or - 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary", "Salt". - :type key_type: str or ~azure.mgmt.webpubsub.models.KeyType + :ivar key_type: The type of access key. Possible values include: "Primary", "Secondary", + "Salt". + :vartype key_type: str or ~azure.mgmt.webpubsub.models.KeyType """ _attribute_map = { @@ -987,6 +1215,11 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword key_type: The type of access key. Possible values include: "Primary", "Secondary", + "Salt". + :paramtype key_type: str or ~azure.mgmt.webpubsub.models.KeyType + """ super(RegenerateKeyParameters, self).__init__(**kwargs) self.key_type = key_type @@ -994,14 +1227,14 @@ def __init__( class ResourceLogCategory(msrest.serialization.Model): """Resource log category configuration of a Microsoft.SignalRService resource. - :param name: Gets or sets the resource log category's name. + :ivar name: Gets or sets the resource log category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. - :type name: str - :param enabled: Indicates whether or the resource log category is enabled. + :vartype name: str + :ivar enabled: Indicates whether or the resource log category is enabled. Available values: true, false. Case insensitive. - :type enabled: str + :vartype enabled: str """ _attribute_map = { @@ -1016,6 +1249,16 @@ def __init__( enabled: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets or sets the resource log category's name. + Available values: ConnectivityLogs, MessagingLogs. + Case insensitive. + :paramtype name: str + :keyword enabled: Indicates whether or the resource log category is enabled. + Available values: true, false. + Case insensitive. + :paramtype enabled: str + """ super(ResourceLogCategory, self).__init__(**kwargs) self.name = name self.enabled = enabled @@ -1024,8 +1267,8 @@ def __init__( class ResourceLogConfiguration(msrest.serialization.Model): """Resource log configuration of a Microsoft.SignalRService resource. - :param categories: Gets or sets the list of category configurations. - :type categories: list[~azure.mgmt.webpubsub.models.ResourceLogCategory] + :ivar categories: Gets or sets the list of category configurations. + :vartype categories: list[~azure.mgmt.webpubsub.models.ResourceLogCategory] """ _attribute_map = { @@ -1038,6 +1281,10 @@ def __init__( categories: Optional[List["ResourceLogCategory"]] = None, **kwargs ): + """ + :keyword categories: Gets or sets the list of category configurations. + :paramtype categories: list[~azure.mgmt.webpubsub.models.ResourceLogCategory] + """ super(ResourceLogConfiguration, self).__init__(**kwargs) self.categories = categories @@ -1049,25 +1296,25 @@ class ResourceSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the SKU. Required. + :ivar name: Required. The name of the SKU. Required. Allowed values: Standard_S1, Free_F1. - :type name: str - :param tier: Optional tier of this particular SKU. 'Standard' or 'Free'. + :vartype name: str + :ivar tier: Optional tier of this particular SKU. 'Standard' or 'Free'. ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", "Standard", "Premium". - :type tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier + :vartype tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier :ivar size: Not used. Retained for future use. :vartype size: str :ivar family: Not used. Retained for future use. :vartype family: str - :param capacity: Optional, integer. The unit count of the resource. 1 by default. + :ivar capacity: Optional, integer. The unit count of the resource. 1 by default. If present, following values are allowed: Free: 1 Standard: 1,2,5,10,20,50,100. - :type capacity: int + :vartype capacity: int """ _validation = { @@ -1092,6 +1339,23 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the SKU. Required. + + Allowed values: Standard_S1, Free_F1. + :paramtype name: str + :keyword tier: Optional tier of this particular SKU. 'Standard' or 'Free'. + + ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier + :keyword capacity: Optional, integer. The unit count of the resource. 1 by default. + + If present, following values are allowed: + Free: 1 + Standard: 1,2,5,10,20,50,100. + :paramtype capacity: int + """ super(ResourceSku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -1103,10 +1367,10 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """An object that describes a specification. - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] - :param log_specifications: Specifications of the Logs for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] + :ivar log_specifications: Specifications of the Logs for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] """ _attribute_map = { @@ -1121,6 +1385,12 @@ def __init__( log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] + :keyword log_specifications: Specifications of the Logs for Azure Monitoring. + :paramtype log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1129,15 +1399,15 @@ def __init__( class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): """Describes the properties of a resource type that has been onboarded to private link service. - :param description: The description of the resource type that has been onboarded to private - link service. - :type description: str - :param group_id: The resource provider group id for the resource that has been onboarded to + :ivar description: The description of the resource type that has been onboarded to private link + service. + :vartype description: str + :ivar group_id: The resource provider group id for the resource that has been onboarded to private link service. - :type group_id: str - :param type: The resource provider type for the resource that has been onboarded to private - link service. - :type type: str + :vartype group_id: str + :ivar type: The resource provider type for the resource that has been onboarded to private link + service. + :vartype type: str """ _attribute_map = { @@ -1154,6 +1424,17 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword description: The description of the resource type that has been onboarded to private + link service. + :paramtype description: str + :keyword group_id: The resource provider group id for the resource that has been onboarded to + private link service. + :paramtype group_id: str + :keyword type: The resource provider type for the resource that has been onboarded to private + link service. + :paramtype type: str + """ super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) self.description = description self.group_id = group_id @@ -1163,11 +1444,11 @@ def __init__( class ShareablePrivateLinkResourceType(msrest.serialization.Model): """Describes a resource type that has been onboarded to private link service. - :param name: The name of the resource type that has been onboarded to private link service. - :type name: str - :param properties: Describes the properties of a resource type that has been onboarded to + :ivar name: The name of the resource type that has been onboarded to private link service. + :vartype name: str + :ivar properties: Describes the properties of a resource type that has been onboarded to private link service. - :type properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties + :vartype properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties """ _attribute_map = { @@ -1182,6 +1463,13 @@ def __init__( properties: Optional["ShareablePrivateLinkResourceProperties"] = None, **kwargs ): + """ + :keyword name: The name of the resource type that has been onboarded to private link service. + :paramtype name: str + :keyword properties: Describes the properties of a resource type that has been onboarded to + private link service. + :paramtype properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties + """ super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) self.name = name self.properties = properties @@ -1200,19 +1488,19 @@ class SharedPrivateLinkResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :param group_id: The group id from the provider of resource the shared private link resource is + :ivar group_id: The group id from the provider of resource the shared private link resource is for. - :type group_id: str - :param private_link_resource_id: The resource id of the resource the shared private link + :vartype group_id: str + :ivar private_link_resource_id: The resource id of the resource the shared private link resource is for. - :type private_link_resource_id: str - :ivar provisioning_state: Provisioning state of the shared private link resource. Possible - values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", - "Updating", "Deleting", "Moving". + :vartype private_link_resource_id: str + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", + "Moving". :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState - :param request_message: The request message for requesting approval of the shared private link + :ivar request_message: The request message for requesting approval of the shared private link resource. - :type request_message: str + :vartype request_message: str :ivar status: Status of the shared private link resource. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". :vartype status: str or ~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceStatus @@ -1247,6 +1535,17 @@ def __init__( request_message: Optional[str] = None, **kwargs ): + """ + :keyword group_id: The group id from the provider of resource the shared private link resource + is for. + :paramtype group_id: str + :keyword private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :paramtype private_link_resource_id: str + :keyword request_message: The request message for requesting approval of the shared private + link resource. + :paramtype request_message: str + """ super(SharedPrivateLinkResource, self).__init__(**kwargs) self.system_data = None self.group_id = group_id @@ -1259,12 +1558,12 @@ def __init__( class SharedPrivateLinkResourceList(msrest.serialization.Model): """A list of shared private link resources. - :param value: The list of the shared private link resources. - :type value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :param next_link: Request URL that can be used to query next page of private endpoint + :ivar value: The list of the shared private link resources. + :vartype value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :ivar next_link: Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1279,6 +1578,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of the shared private link resources. + :paramtype value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :keyword next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :paramtype next_link: str + """ super(SharedPrivateLinkResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1287,18 +1594,18 @@ def __init__( class SignalRServiceUsage(msrest.serialization.Model): """Object that describes a specific usage of the resources. - :param id: Fully qualified ARM resource id. - :type id: str - :param current_value: Current value for the usage quota. - :type current_value: long - :param limit: The maximum permitted value for the usage quota. If there is no limit, this value + :ivar id: Fully qualified ARM resource id. + :vartype id: str + :ivar current_value: Current value for the usage quota. + :vartype current_value: long + :ivar limit: The maximum permitted value for the usage quota. If there is no limit, this value will be -1. - :type limit: long - :param name: Localizable String object containing the name and a localized value. - :type name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName - :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + :vartype limit: long + :ivar name: Localizable String object containing the name and a localized value. + :vartype name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName + :ivar unit: Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. - :type unit: str + :vartype unit: str """ _attribute_map = { @@ -1319,6 +1626,20 @@ def __init__( unit: Optional[str] = None, **kwargs ): + """ + :keyword id: Fully qualified ARM resource id. + :paramtype id: str + :keyword current_value: Current value for the usage quota. + :paramtype current_value: long + :keyword limit: The maximum permitted value for the usage quota. If there is no limit, this + value will be -1. + :paramtype limit: long + :keyword name: Localizable String object containing the name and a localized value. + :paramtype name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName + :keyword unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :paramtype unit: str + """ super(SignalRServiceUsage, self).__init__(**kwargs) self.id = id self.current_value = current_value @@ -1330,12 +1651,11 @@ def __init__( class SignalRServiceUsageList(msrest.serialization.Model): """Object that includes an array of the resource usages and a possible link for next set. - :param value: List of the resource usages. - :type value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). + :ivar value: List of the resource usages. + :vartype value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1350,6 +1670,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of the resource usages. + :paramtype value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(SignalRServiceUsageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1358,10 +1686,10 @@ def __init__( class SignalRServiceUsageName(msrest.serialization.Model): """Localizable String object containing the name and a localized value. - :param value: The identifier of the usage. - :type value: str - :param localized_value: Localized name of the usage. - :type localized_value: str + :ivar value: The identifier of the usage. + :vartype value: str + :ivar localized_value: Localized name of the usage. + :vartype localized_value: str """ _attribute_map = { @@ -1376,6 +1704,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The identifier of the usage. + :paramtype value: str + :keyword localized_value: Localized name of the usage. + :paramtype localized_value: str + """ super(SignalRServiceUsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -1388,9 +1722,9 @@ class Sku(msrest.serialization.Model): :ivar resource_type: The resource type that this object applies to. :vartype resource_type: str - :ivar sku: The exact set of keys that define this sku. + :ivar sku: The billing information of the resource. :vartype sku: ~azure.mgmt.webpubsub.models.ResourceSku - :ivar capacity: Specifies the unit of the resource. + :ivar capacity: Describes scaling information of a sku. :vartype capacity: ~azure.mgmt.webpubsub.models.SkuCapacity """ @@ -1410,6 +1744,8 @@ def __init__( self, **kwargs ): + """ + """ super(Sku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -1454,6 +1790,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -1488,6 +1826,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1496,20 +1836,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.webpubsub.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.webpubsub.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.webpubsub.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.webpubsub.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1532,6 +1872,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.webpubsub.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.webpubsub.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 @@ -1552,12 +1908,12 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". :vartype type: str - :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + :ivar location: The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -1581,20 +1937,26 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. e.g. West US | East US | North Central US + | South Central US. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags class UpstreamAuthSettings(msrest.serialization.Model): - """Upstream auth settings. - - :param type: Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible - values include: "None", "ManagedIdentity". - :type type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType - :param managed_identity: Gets or sets the managed identity settings. It's required if the auth - type is set to ManagedIdentity. - :type managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings + """Upstream auth settings. If not set, no auth is used for upstream messages. + + :ivar type: Upstream auth type enum. Possible values include: "None", "ManagedIdentity". + :vartype type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType + :ivar managed_identity: Managed identity settings for upstream. + :vartype managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings """ _attribute_map = { @@ -1609,6 +1971,12 @@ def __init__( managed_identity: Optional["ManagedIdentitySettings"] = None, **kwargs ): + """ + :keyword type: Upstream auth type enum. Possible values include: "None", "ManagedIdentity". + :paramtype type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType + :keyword managed_identity: Managed identity settings for upstream. + :paramtype managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings + """ super(UpstreamAuthSettings, self).__init__(**kwargs) self.type = type self.managed_identity = managed_identity @@ -1639,6 +2007,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentityProperty, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -1659,8 +2029,8 @@ class WebPubSubHub(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData - :param properties: Required. Properties of the hub setting. - :type properties: ~azure.mgmt.webpubsub.models.WebPubSubHubProperties + :ivar properties: Required. Properties of a hub. + :vartype properties: ~azure.mgmt.webpubsub.models.WebPubSubHubProperties """ _validation = { @@ -1685,6 +2055,10 @@ def __init__( properties: "WebPubSubHubProperties", **kwargs ): + """ + :keyword properties: Required. Properties of a hub. + :paramtype properties: ~azure.mgmt.webpubsub.models.WebPubSubHubProperties + """ super(WebPubSubHub, self).__init__(**kwargs) self.system_data = None self.properties = properties @@ -1695,8 +2069,8 @@ class WebPubSubHubList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of hub settings to this resource. - :type value: list[~azure.mgmt.webpubsub.models.WebPubSubHub] + :ivar value: List of hub settings to this resource. + :vartype value: list[~azure.mgmt.webpubsub.models.WebPubSubHub] :ivar next_link: The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. :vartype next_link: str @@ -1717,6 +2091,10 @@ def __init__( value: Optional[List["WebPubSubHub"]] = None, **kwargs ): + """ + :keyword value: List of hub settings to this resource. + :paramtype value: list[~azure.mgmt.webpubsub.models.WebPubSubHub] + """ super(WebPubSubHubList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1725,11 +2103,11 @@ def __init__( class WebPubSubHubProperties(msrest.serialization.Model): """Properties of a hub. - :param event_handlers: Event handler of a hub. - :type event_handlers: list[~azure.mgmt.webpubsub.models.EventHandler] - :param anonymous_connect_policy: The settings for configuring if anonymous connections are + :ivar event_handlers: Event handler of a hub. + :vartype event_handlers: list[~azure.mgmt.webpubsub.models.EventHandler] + :ivar anonymous_connect_policy: The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". - :type anonymous_connect_policy: str + :vartype anonymous_connect_policy: str """ _attribute_map = { @@ -1744,6 +2122,13 @@ def __init__( anonymous_connect_policy: Optional[str] = "deny", **kwargs ): + """ + :keyword event_handlers: Event handler of a hub. + :paramtype event_handlers: list[~azure.mgmt.webpubsub.models.EventHandler] + :keyword anonymous_connect_policy: The settings for configuring if anonymous connections are + allowed for this hub: "allow" or "deny". Default to "deny". + :paramtype anonymous_connect_policy: str + """ super(WebPubSubHubProperties, self).__init__(**kwargs) self.event_handlers = event_handlers self.anonymous_connect_policy = anonymous_connect_policy @@ -1752,14 +2137,14 @@ def __init__( class WebPubSubKeys(msrest.serialization.Model): """A class represents the access keys of the resource. - :param primary_key: The primary access key. - :type primary_key: str - :param secondary_key: The secondary access key. - :type secondary_key: str - :param primary_connection_string: Connection string constructed via the primaryKey. - :type primary_connection_string: str - :param secondary_connection_string: Connection string constructed via the secondaryKey. - :type secondary_connection_string: str + :ivar primary_key: The primary access key. + :vartype primary_key: str + :ivar secondary_key: The secondary access key. + :vartype secondary_key: str + :ivar primary_connection_string: Connection string constructed via the primaryKey. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Connection string constructed via the secondaryKey. + :vartype secondary_connection_string: str """ _attribute_map = { @@ -1778,6 +2163,16 @@ def __init__( secondary_connection_string: Optional[str] = None, **kwargs ): + """ + :keyword primary_key: The primary access key. + :paramtype primary_key: str + :keyword secondary_key: The secondary access key. + :paramtype secondary_key: str + :keyword primary_connection_string: Connection string constructed via the primaryKey. + :paramtype primary_connection_string: str + :keyword secondary_connection_string: Connection string constructed via the secondaryKey. + :paramtype secondary_connection_string: str + """ super(WebPubSubKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -1788,13 +2183,12 @@ def __init__( class WebPubSubNetworkACLs(msrest.serialization.Model): """Network ACLs for the resource. - :param default_action: Default action when no other rule matches. Possible values include: - "Allow", "Deny". - :type default_action: str or ~azure.mgmt.webpubsub.models.ACLAction - :param public_network: ACL for requests from public network. - :type public_network: ~azure.mgmt.webpubsub.models.NetworkACL - :param private_endpoints: ACLs for requests from private endpoints. - :type private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] + :ivar default_action: Azure Networking ACL Action. Possible values include: "Allow", "Deny". + :vartype default_action: str or ~azure.mgmt.webpubsub.models.ACLAction + :ivar public_network: Network ACL. + :vartype public_network: ~azure.mgmt.webpubsub.models.NetworkACL + :ivar private_endpoints: ACLs for requests from private endpoints. + :vartype private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] """ _attribute_map = { @@ -1811,6 +2205,14 @@ def __init__( private_endpoints: Optional[List["PrivateEndpointACL"]] = None, **kwargs ): + """ + :keyword default_action: Azure Networking ACL Action. Possible values include: "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.webpubsub.models.ACLAction + :keyword public_network: Network ACL. + :paramtype public_network: ~azure.mgmt.webpubsub.models.NetworkACL + :keyword private_endpoints: ACLs for requests from private endpoints. + :paramtype private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] + """ super(WebPubSubNetworkACLs, self).__init__(**kwargs) self.default_action = default_action self.public_network = public_network @@ -1828,16 +2230,16 @@ class WebPubSubResource(TrackedResource): :vartype name: str :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". :vartype type: str - :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + :ivar location: The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param sku: The billing information of the resource.(e.g. Free, Standard). - :type sku: ~azure.mgmt.webpubsub.models.ResourceSku - :param identity: The managed identity response. - :type identity: ~azure.mgmt.webpubsub.models.ManagedIdentity + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar sku: The billing information of the resource. + :vartype sku: ~azure.mgmt.webpubsub.models.ResourceSku + :ivar identity: A class represent managed identities used for request and response. + :vartype identity: ~azure.mgmt.webpubsub.models.ManagedIdentity :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: @@ -1863,34 +2265,31 @@ class WebPubSubResource(TrackedResource): :ivar shared_private_link_resources: The list of shared private link resources. :vartype shared_private_link_resources: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :param tls: TLS settings. - :type tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings + :ivar tls: TLS settings for the resource. + :vartype tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings :ivar host_name_prefix: Deprecated. :vartype host_name_prefix: str - :param live_trace_configuration: Live trace configuration of a Microsoft.SignalRService + :ivar live_trace_configuration: Live trace configuration of a Microsoft.SignalRService resource. - :type live_trace_configuration: ~azure.mgmt.webpubsub.models.LiveTraceConfiguration - :param resource_log_configuration: Resource log configuration of a Microsoft.SignalRService + :vartype live_trace_configuration: ~azure.mgmt.webpubsub.models.LiveTraceConfiguration + :ivar resource_log_configuration: Resource log configuration of a Microsoft.SignalRService resource. - If resourceLogConfiguration isn't null or empty, it will override options - "EnableConnectivityLog" and "EnableMessagingLogs" in features. - Otherwise, use options "EnableConnectivityLog" and "EnableMessagingLogs" in features. - :type resource_log_configuration: ~azure.mgmt.webpubsub.models.ResourceLogConfiguration - :param network_ac_ls: Network ACLs. - :type network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs - :param public_network_access: Enable or disable public network access. Default to "Enabled". + :vartype resource_log_configuration: ~azure.mgmt.webpubsub.models.ResourceLogConfiguration + :ivar network_ac_ls: Network ACLs for the resource. + :vartype network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs + :ivar public_network_access: Enable or disable public network access. Default to "Enabled". When it's Enabled, network ACLs still apply. When it's Disabled, public network access is always disabled no matter what you set in network ACLs. - :type public_network_access: str - :param disable_local_auth: DisableLocalAuth + :vartype public_network_access: str + :ivar disable_local_auth: DisableLocalAuth Enable or disable local auth with AccessKey When set as true, connection with AccessKey=xxx won't work. - :type disable_local_auth: bool - :param disable_aad_auth: DisableLocalAuth + :vartype disable_local_auth: bool + :ivar disable_aad_auth: DisableLocalAuth Enable or disable aad auth When set as true, connection with AuthType=aad won't work. - :type disable_aad_auth: bool + :vartype disable_aad_auth: bool """ _validation = { @@ -1952,6 +2351,41 @@ def __init__( disable_aad_auth: Optional[bool] = False, **kwargs ): + """ + :keyword location: The GEO location of the resource. e.g. West US | East US | North Central US + | South Central US. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword sku: The billing information of the resource. + :paramtype sku: ~azure.mgmt.webpubsub.models.ResourceSku + :keyword identity: A class represent managed identities used for request and response. + :paramtype identity: ~azure.mgmt.webpubsub.models.ManagedIdentity + :keyword tls: TLS settings for the resource. + :paramtype tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings + :keyword live_trace_configuration: Live trace configuration of a Microsoft.SignalRService + resource. + :paramtype live_trace_configuration: ~azure.mgmt.webpubsub.models.LiveTraceConfiguration + :keyword resource_log_configuration: Resource log configuration of a Microsoft.SignalRService + resource. + :paramtype resource_log_configuration: ~azure.mgmt.webpubsub.models.ResourceLogConfiguration + :keyword network_ac_ls: Network ACLs for the resource. + :paramtype network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs + :keyword public_network_access: Enable or disable public network access. Default to "Enabled". + When it's Enabled, network ACLs still apply. + When it's Disabled, public network access is always disabled no matter what you set in network + ACLs. + :paramtype public_network_access: str + :keyword disable_local_auth: DisableLocalAuth + Enable or disable local auth with AccessKey + When set as true, connection with AccessKey=xxx won't work. + :paramtype disable_local_auth: bool + :keyword disable_aad_auth: DisableLocalAuth + Enable or disable aad auth + When set as true, connection with AuthType=aad won't work. + :paramtype disable_aad_auth: bool + """ super(WebPubSubResource, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.identity = identity @@ -1977,12 +2411,11 @@ def __init__( class WebPubSubResourceList(msrest.serialization.Model): """Object that includes an array of resources and a possible link for next set. - :param value: List of the resources. - :type value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). + :ivar value: List of the resources. + :vartype value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1997,6 +2430,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of the resources. + :paramtype value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(WebPubSubResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2005,8 +2446,8 @@ def __init__( class WebPubSubTlsSettings(msrest.serialization.Model): """TLS settings for the resource. - :param client_cert_enabled: Request client certificate during TLS handshake if enabled. - :type client_cert_enabled: bool + :ivar client_cert_enabled: Request client certificate during TLS handshake if enabled. + :vartype client_cert_enabled: bool """ _attribute_map = { @@ -2019,5 +2460,9 @@ def __init__( client_cert_enabled: Optional[bool] = True, **kwargs ): + """ + :keyword client_cert_enabled: Request client certificate during TLS handshake if enabled. + :paramtype client_cert_enabled: bool + """ super(WebPubSubTlsSettings, self).__init__(**kwargs) self.client_cert_enabled = client_cert_enabled diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py index 04e396fef8a6..c28080c03a9e 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py @@ -6,34 +6,19 @@ # 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 ACLAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Default action when no other rule matches + +class ACLAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Azure Networking ACL Action. """ ALLOW = "Allow" DENY = "Deny" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -42,23 +27,23 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of access key. """ PRIMARY = "Primary" SECONDARY = "Secondary" SALT = "Salt" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Represent the identity type: systemAssigned, userAssigned, None +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Represents the identity type: systemAssigned, userAssigned, None """ NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. """ @@ -68,7 +53,7 @@ class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ @@ -82,7 +67,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" MOVING = "Moving" -class ScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -90,7 +75,7 @@ class ScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharedPrivateLinkResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the shared private link resource """ @@ -100,16 +85,15 @@ class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, s DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class UpstreamAuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets the type of auth. None or ManagedIdentity is supported now. +class UpstreamAuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Upstream auth type enum. """ NONE = "None" MANAGED_IDENTITY = "ManagedIdentity" -class WebPubSubRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, - RESTAPI. +class WebPubSubRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The incoming request type to the service """ CLIENT_CONNECTION = "ClientConnection" @@ -117,7 +101,7 @@ class WebPubSubRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTAPI = "RESTAPI" TRACE = "Trace" -class WebPubSubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WebPubSubSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Optional tier of this particular SKU. 'Standard' or 'Free'. ``Basic`` is deprecated, use ``Standard`` instead. diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py index 845aef05d550..9824364dcdf6 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.SignalRService/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 + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Lists all of the available REST API operations of the Microsoft.SignalRService provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +122,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py index 0b6ff51f70fd..32960df0893b 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py @@ -5,23 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsagesOperations(object): """UsagesOperations operations. @@ -45,18 +80,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SignalRServiceUsageList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.SignalRServiceUsageList"]: """List resource usage quotas by location. :param location: the location like "eastus". :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SignalRServiceUsageList or the result of cls(response) + :return: An iterator like instance of either SignalRServiceUsageList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SignalRServiceUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # 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_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.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_request( + location=location, + subscription_id=self._config.subscription_id, + 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('SignalRServiceUsageList', pipeline_response) + deserialized = self._deserialize("SignalRServiceUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py index dfe17167fae4..55abdb9755f7 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_get_request( + hub_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}') + path_format_arguments = { + "hubName": _SERIALIZER.url("hub_name", hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_create_or_update_request_initial( + hub_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}') + path_format_arguments = { + "hubName": _SERIALIZER.url("hub_name", hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + hub_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}') + path_format_arguments = { + "hubName": _SERIALIZER.url("hub_name", hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebPubSubHubsOperations(object): """WebPubSubHubsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebPubSubHubList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.WebPubSubHubList"]: """List hub settings. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,36 +229,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('WebPubSubHubList', pipeline_response) + deserialized = self._deserialize("WebPubSubHubList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +268,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs'} # type: ignore + @distributed_trace def get( self, - hub_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WebPubSubHub" + hub_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.WebPubSubHub": """Get a hub setting. :param hub_name: The hub name. @@ -151,34 +307,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubHub', pipeline_response) @@ -187,56 +333,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + def _create_or_update_initial( self, - hub_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubHub" - **kwargs # type: Any - ): - # type: (...) -> "_models.WebPubSubHub" + hub_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubHub", + **kwargs: Any + ) -> "_models.WebPubSubHub": cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubHub"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + 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(parameters, 'WebPubSubHub') + + request = build_create_or_update_request_initial( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'WebPubSubHub') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WebPubSubHub', pipeline_response) @@ -248,17 +384,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - hub_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubHub" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WebPubSubHub"] + hub_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubHub", + **kwargs: Any + ) -> LROPoller["_models.WebPubSubHub"]: """Create or update a hub setting. :param hub_name: The hub name. @@ -272,15 +410,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubHub :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 WebPubSubHub 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 WebPubSubHub or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubHub] - :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.WebPubSubHub"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +435,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubHub', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -326,64 +461,54 @@ 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.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore def _delete_initial( self, - hub_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + hub_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + hub_name=hub_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore + + @distributed_trace def begin_delete( self, - hub_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + hub_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a hub setting. :param hub_name: The hub name. @@ -395,15 +520,17 @@ def begin_delete( :type resource_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', @@ -418,22 +545,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 = { - 'hubName': self._serialize.url("hub_name", hub_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -445,4 +564,5 @@ 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.SignalRService/webPubSub/{resourceName}/hubs/{hubName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py index 262a3d28441c..19fc33b07c47 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py @@ -5,25 +5,441 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + location: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub') + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_keys_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) class WebPubSubOperations(object): """WebPubSubOperations operations. @@ -47,13 +463,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - location, # type: str - parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. @@ -70,37 +486,27 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # 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(parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailability', pipeline_response) @@ -109,17 +515,20 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebPubSubResourceList"] + **kwargs: Any + ) -> Iterable["_models.WebPubSubResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) + :return: An iterator like instance of either WebPubSubResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -128,34 +537,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + 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, + 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('WebPubSubResourceList', pipeline_response) + deserialized = self._deserialize("WebPubSubResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,30 +572,32 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebPubSubResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WebPubSubResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) + :return: An iterator like instance of either WebPubSubResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -200,35 +606,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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') - - 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, + 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, + 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('WebPubSubResourceList', pipeline_response) + deserialized = self._deserialize("WebPubSubResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -241,24 +643,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WebPubSubResource" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.WebPubSubResource": """Get the resource and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -276,33 +679,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') - - # 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, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubResource', pipeline_response) @@ -311,54 +704,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubResource" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WebPubSubResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs: Any + ) -> Optional["_models.WebPubSubResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + 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(parameters, 'WebPubSubResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'WebPubSubResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -371,16 +754,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WebPubSubResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs: Any + ) -> LROPoller["_models.WebPubSubResource"]: """Create or update a resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -392,15 +777,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource :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 WebPubSubResource 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 WebPubSubResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] - :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.WebPubSubResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,27 +801,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubResource', 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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -444,61 +827,51 @@ 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.SignalRService/webPubSub/{resourceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # 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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -508,15 +881,17 @@ def begin_delete( :type resource_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', @@ -530,21 +905,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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -556,54 +924,43 @@ 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.SignalRService/webPubSub/{resourceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubResource" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WebPubSubResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs: Any + ) -> Optional["_models.WebPubSubResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + 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(parameters, 'WebPubSubResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'WebPubSubResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -613,16 +970,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.WebPubSubResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WebPubSubResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs: Any + ) -> LROPoller["_models.WebPubSubResource"]: """Operation to update an exiting resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -634,15 +993,19 @@ def begin_update( :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource :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 WebPubSubResource 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 WebPubSubResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] - :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.WebPubSubResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -654,27 +1017,21 @@ def begin_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubResource', 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'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -686,15 +1043,16 @@ 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.SignalRService/webPubSub/{resourceName}'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WebPubSubKeys" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.WebPubSubKeys": """Get the access keys of the resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -712,33 +1070,23 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.list_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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubKeys', pipeline_response) @@ -747,54 +1095,44 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys'} # type: ignore + def _regenerate_key_initial( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.RegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.WebPubSubKeys" + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs: Any + ) -> "_models.WebPubSubKeys": cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RegenerateKeyParameters') - # 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_regenerate_key_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'RegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('WebPubSubKeys', pipeline_response) @@ -802,16 +1140,18 @@ def _regenerate_key_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + @distributed_trace def begin_regenerate_key( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.RegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WebPubSubKeys"] + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs: Any + ) -> LROPoller["_models.WebPubSubKeys"]: """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. @@ -824,15 +1164,19 @@ def begin_regenerate_key( :type parameters: ~azure.mgmt.webpubsub.models.RegenerateKeyParameters :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 WebPubSubKeys 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 WebPubSubKeys or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubKeys] - :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.WebPubSubKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -844,27 +1188,21 @@ def begin_regenerate_key( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('WebPubSubKeys', 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -876,61 +1214,51 @@ 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.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore def _restart_initial( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._restart_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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self._restart_initial.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 if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to restart a resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -940,15 +1268,17 @@ def begin_restart( :type resource_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', @@ -962,21 +1292,14 @@ def begin_restart( 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'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -988,15 +1311,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + @distributed_trace def list_skus( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SkuList" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.SkuList": """List all available skus of the resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1014,33 +1338,23 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.list_skus.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'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_skus.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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SkuList', pipeline_response) @@ -1049,4 +1363,6 @@ def list_skus( return cls(pipeline_response, deserialized, {}) return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/skus'} # type: ignore + diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py index 74d3d3738a30..f712e9d3993a 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_get_request( + private_endpoint_connection_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_update_request( + private_endpoint_connection_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + private_endpoint_connection_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebPubSubPrivateEndpointConnectionsOperations(object): """WebPubSubPrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionList"]: """List private endpoint connections. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -62,8 +220,10 @@ def list( :param resource_name: The name of the resource. :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 PrivateEndpointConnectionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - private_endpoint_connection_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get the specified private endpoint connection. :param private_endpoint_connection_name: The name of the private endpoint connection. @@ -151,34 +309,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -187,17 +335,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def update( self, - private_endpoint_connection_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update the state of specified private endpoint connection. :param private_endpoint_connection_name: The name of the private endpoint connection. @@ -219,39 +369,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + 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(parameters, 'PrivateEndpointConnection') + + request = build_update_request( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -260,64 +400,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - private_endpoint_connection_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - private_endpoint_connection_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the specified private endpoint connection. :param private_endpoint_connection_name: The name of the private endpoint connection. @@ -329,15 +460,17 @@ def begin_delete( :type resource_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', @@ -352,22 +485,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 = { - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -379,4 +504,5 @@ 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.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py index 466906384635..d6349b5b8f31 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) class WebPubSubPrivateLinkResourcesOperations(object): """WebPubSubPrivateLinkResourcesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceList"]: """Get the private link resources that need to be created for a resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -60,7 +97,8 @@ def list( :param resource_name: The name of the resource. :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 PrivateLinkResourceList or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.PrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -69,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,12 +146,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py index c4f1e952e004..2439fb299e36 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_get_request( + shared_private_link_resource_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}') + path_format_arguments = { + "sharedPrivateLinkResourceName": _SERIALIZER.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 + ) + + +def build_create_or_update_request_initial( + shared_private_link_resource_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}') + path_format_arguments = { + "sharedPrivateLinkResourceName": _SERIALIZER.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + shared_private_link_resource_name: str, + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}') + path_format_arguments = { + "sharedPrivateLinkResourceName": _SERIALIZER.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WebPubSubSharedPrivateLinkResourcesOperations(object): """WebPubSubSharedPrivateLinkResourcesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SharedPrivateLinkResourceList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.SharedPrivateLinkResourceList"]: """List shared private link resources. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -62,8 +220,10 @@ def list( :param resource_name: The name of the resource. :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 SharedPrivateLinkResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] @@ -71,36 +231,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 - 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'), - '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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list.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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('SharedPrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("SharedPrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources'} # type: ignore + @distributed_trace def get( self, - shared_private_link_resource_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedPrivateLinkResource" + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.SharedPrivateLinkResource": """Get the specified shared private link resource. :param shared_private_link_resource_name: The name of the shared private link resource. @@ -151,34 +309,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) @@ -187,56 +335,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + def _create_or_update_initial( self, - shared_private_link_resource_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SharedPrivateLinkResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.SharedPrivateLinkResource" + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs: Any + ) -> "_models.SharedPrivateLinkResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-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 = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') + 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(parameters, 'SharedPrivateLinkResource') + + request = build_create_or_update_request_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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(parameters, 'SharedPrivateLinkResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) @@ -248,17 +386,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - shared_private_link_resource_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SharedPrivateLinkResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SharedPrivateLinkResource"] + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs: Any + ) -> LROPoller["_models.SharedPrivateLinkResource"]: """Create or update a shared private link resource. :param shared_private_link_resource_name: The name of the shared private link resource. @@ -272,15 +412,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource :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 SharedPrivateLinkResource 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 SharedPrivateLinkResource or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] - :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.SharedPrivateLinkResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +437,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=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('SharedPrivateLinkResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -326,64 +463,54 @@ 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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore def _delete_initial( self, - shared_private_link_resource_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - shared_private_link_resource_name, # type: str - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the specified shared private link resource. :param shared_private_link_resource_name: The name of the shared private link resource. @@ -395,15 +522,17 @@ def begin_delete( :type resource_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', @@ -418,22 +547,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 = { - 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'resourceName': self._serialize.url("resource_name", resource_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: @@ -445,4 +566,5 @@ 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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore