From 22cadd8e3906f92001290c3a375dbaa6b89ac09d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 11 Feb 2022 10:43:14 +0000 Subject: [PATCH] CodeGen from PR 17748 in Azure/azure-rest-api-specs Merge d5f7749107e77627276af273f10206f1882dfc02 into 7c98de7664d4565c088350015ccd0cfc102eab49 --- sdk/signalr/azure-mgmt-signalr/_meta.json | 10 +- .../azure/mgmt/signalr/__init__.py | 9 +- .../azure/mgmt/signalr/_configuration.py | 19 +- .../azure/mgmt/signalr/_metadata.json | 21 +- .../azure/mgmt/signalr/_patch.py | 31 + .../signalr/_signal_rmanagement_client.py | 118 +- .../azure/mgmt/signalr/_vendor.py | 27 + .../azure/mgmt/signalr/_version.py | 2 +- .../azure/mgmt/signalr/aio/__init__.py | 5 + .../azure/mgmt/signalr/aio/_configuration.py | 6 +- .../azure/mgmt/signalr/aio/_patch.py | 31 + .../signalr/aio/_signal_rmanagement_client.py | 106 +- .../signalr/aio/operations/_operations.py | 44 +- .../aio/operations/_signal_r_operations.py | 559 +++-- ...private_endpoint_connections_operations.py | 200 +- ...gnal_rprivate_link_resources_operations.py | 64 +- ...hared_private_link_resources_operations.py | 234 +-- .../aio/operations/_usages_operations.py | 55 +- .../azure/mgmt/signalr/models/__init__.py | 159 +- .../azure/mgmt/signalr/models/_models.py | 1831 ----------------- .../azure/mgmt/signalr/models/_models_py3.py | 1039 +++++++--- .../_signal_rmanagement_client_enums.py | 60 +- .../mgmt/signalr/operations/_operations.py | 85 +- .../operations/_signal_r_operations.py | 1134 ++++++---- ...private_endpoint_connections_operations.py | 419 ++-- ...gnal_rprivate_link_resources_operations.py | 116 +- ...hared_private_link_resources_operations.py | 463 +++-- .../signalr/operations/_usages_operations.py | 106 +- 28 files changed, 3082 insertions(+), 3871 deletions(-) create mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_patch.py create mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py create mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_patch.py delete mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py diff --git a/sdk/signalr/azure-mgmt-signalr/_meta.json b/sdk/signalr/azure-mgmt-signalr/_meta.json index 816b6e8dac997..cb1be39f21f22 100644 --- a/sdk/signalr/azure-mgmt-signalr/_meta.json +++ b/sdk/signalr/azure-mgmt-signalr/_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": "1df76adb301b0b1f78375aacd19005f151ef6f72", + "commit": "09d95cf06bd2d495c357476c5888599450bd82f5", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/signalr/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/signalr/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/signalr/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/__init__.py index f42f5a3a96a78..a4c83e80f9257 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SignalRManagementClient'] -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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py index 65b7152fe3bbc..65e002acb479e 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_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 SignalRManagementClientConfiguration(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(SignalRManagementClientConfiguration, 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(SignalRManagementClientConfiguration, 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_metadata.json b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_metadata.json index d0c88e64bba70..8123149ba4707 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_metadata.json +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_metadata.json @@ -5,13 +5,13 @@ "name": "SignalRManagementClient", "filename": "_signal_rmanagement_client", "description": "REST API for Azure SignalR 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\": [\"SignalRManagementClientConfiguration\"]}}, \"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\": [\"SignalRManagementClientConfiguration\"]}}, \"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\": [\"SignalRManagementClientConfiguration\"]}}, \"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\": [\"SignalRManagementClientConfiguration\"]}}, \"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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_patch.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py index cf3fca53100a9..9746594822519 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py @@ -6,29 +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 SignalRManagementClientConfiguration +from .operations import Operations, SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations + 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 SignalRManagementClientConfiguration -from .operations import Operations -from .operations import SignalROperations -from .operations import UsagesOperations -from .operations import SignalRPrivateEndpointConnectionsOperations -from .operations import SignalRPrivateLinkResourcesOperations -from .operations import SignalRSharedPrivateLinkResourcesOperations -from . import models - -class SignalRManagementClient(object): +class SignalRManagementClient: """REST API for Azure SignalR Service. :ivar operations: Operations operations @@ -37,68 +30,75 @@ class SignalRManagementClient(object): :vartype signal_r: azure.mgmt.signalr.operations.SignalROperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.signalr.operations.UsagesOperations - :ivar signal_rprivate_endpoint_connections: SignalRPrivateEndpointConnectionsOperations operations - :vartype signal_rprivate_endpoint_connections: azure.mgmt.signalr.operations.SignalRPrivateEndpointConnectionsOperations + :ivar signal_rprivate_endpoint_connections: SignalRPrivateEndpointConnectionsOperations + operations + :vartype signal_rprivate_endpoint_connections: + azure.mgmt.signalr.operations.SignalRPrivateEndpointConnectionsOperations :ivar signal_rprivate_link_resources: SignalRPrivateLinkResourcesOperations operations - :vartype signal_rprivate_link_resources: azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations - :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations - :vartype signal_rshared_private_link_resources: azure.mgmt.signalr.operations.SignalRSharedPrivateLinkResourcesOperations + :vartype signal_rprivate_link_resources: + azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations + :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations + operations + :vartype signal_rshared_private_link_resources: + azure.mgmt.signalr.operations.SignalRSharedPrivateLinkResourcesOperations :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 = SignalRManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SignalRManagementClientConfiguration(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.signal_r = SignalROperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rprivate_endpoint_connections = SignalRPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_r = SignalROperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rprivate_endpoint_connections = SignalRPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( - 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py index c47f66669f1bf..e5754a47ce68f 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_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 = "1.0.0b1" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/__init__.py index a7ee94675f6e2..883d13814096a 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/__init__.py @@ -8,3 +8,8 @@ from ._signal_rmanagement_client import SignalRManagementClient __all__ = ['SignalRManagementClient'] + +# `._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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py index 62afbf2586296..a98068a0e6fbb 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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(SignalRManagementClientConfiguration, 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(SignalRManagementClientConfiguration, 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_patch.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py index 88e7b4155c372..5c4102b6f57df 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py @@ -6,27 +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 SignalRManagementClientConfiguration +from .operations import Operations, SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SignalRManagementClientConfiguration -from .operations import Operations -from .operations import SignalROperations -from .operations import UsagesOperations -from .operations import SignalRPrivateEndpointConnectionsOperations -from .operations import SignalRPrivateLinkResourcesOperations -from .operations import SignalRSharedPrivateLinkResourcesOperations -from .. import models - - -class SignalRManagementClient(object): +class SignalRManagementClient: """REST API for Azure SignalR Service. :ivar operations: Operations operations @@ -35,66 +30,75 @@ class SignalRManagementClient(object): :vartype signal_r: azure.mgmt.signalr.aio.operations.SignalROperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.signalr.aio.operations.UsagesOperations - :ivar signal_rprivate_endpoint_connections: SignalRPrivateEndpointConnectionsOperations operations - :vartype signal_rprivate_endpoint_connections: azure.mgmt.signalr.aio.operations.SignalRPrivateEndpointConnectionsOperations + :ivar signal_rprivate_endpoint_connections: SignalRPrivateEndpointConnectionsOperations + operations + :vartype signal_rprivate_endpoint_connections: + azure.mgmt.signalr.aio.operations.SignalRPrivateEndpointConnectionsOperations :ivar signal_rprivate_link_resources: SignalRPrivateLinkResourcesOperations operations - :vartype signal_rprivate_link_resources: azure.mgmt.signalr.aio.operations.SignalRPrivateLinkResourcesOperations - :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations - :vartype signal_rshared_private_link_resources: azure.mgmt.signalr.aio.operations.SignalRSharedPrivateLinkResourcesOperations + :vartype signal_rprivate_link_resources: + azure.mgmt.signalr.aio.operations.SignalRPrivateLinkResourcesOperations + :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations + operations + :vartype signal_rshared_private_link_resources: + azure.mgmt.signalr.aio.operations.SignalRSharedPrivateLinkResourcesOperations :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 = SignalRManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = SignalRManagementClientConfiguration(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.signal_r = SignalROperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rprivate_endpoint_connections = SignalRPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_r = SignalROperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rprivate_endpoint_connections = SignalRPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( - 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py index cb8a1b283a52b..7f7358249b771 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py index 4b6acc9b28cb4..20c487388ef1d 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_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._signal_r_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 @@ -122,34 +121,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('SignalRResourceList', pipeline_response) + deserialized = self._deserialize("SignalRResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -162,17 +156,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/signalR'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -193,35 +189,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('SignalRResourceList', pipeline_response) + deserialized = self._deserialize("SignalRResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -234,17 +226,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/signalR'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -268,33 +262,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('SignalRResource', pipeline_response) @@ -303,8 +287,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -317,39 +303,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, 'SignalRResource') - # 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, 'SignalRResource') - 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 +337,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/signalR/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -382,15 +360,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.signalr.models.SignalRResource :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 SignalRResource 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 SignalRResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SignalRResource] - :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.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,27 +384,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('SignalRResource', 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 +410,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/signalR/{resourceName}'} # type: ignore async def _delete_initial( @@ -447,40 +424,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/signalR/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -496,15 +464,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 +488,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 +507,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/signalR/{resourceName}'} # type: ignore async def _update_initial( @@ -558,39 +522,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, 'SignalRResource') + + 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, 'SignalRResource') - 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 +553,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -620,15 +576,19 @@ async def begin_update( :type parameters: ~azure.mgmt.signalr.models.SignalRResource :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 SignalRResource 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 SignalRResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SignalRResource] - :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.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -640,27 +600,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('SignalRResource', 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 +626,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/signalR/{resourceName}'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -697,33 +653,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('SignalRKeys', pipeline_response) @@ -732,8 +678,10 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} # type: ignore + async def _regenerate_key_initial( self, resource_group_name: str, @@ -746,39 +694,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('SignalRKeys', pipeline_response) @@ -786,8 +723,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/signalR/{resourceName}/regenerateKey'} # type: ignore + + @distributed_trace_async async def begin_regenerate_key( self, resource_group_name: str, @@ -807,15 +747,19 @@ async def begin_regenerate_key( :type parameters: ~azure.mgmt.signalr.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 SignalRKeys 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 SignalRKeys or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SignalRKeys] - :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.SignalRKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -827,27 +771,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('SignalRKeys', 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 +797,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/signalR/{resourceName}/regenerateKey'} # type: ignore async def _restart_initial( @@ -872,40 +811,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/signalR/{resourceName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -921,15 +851,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 +875,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 +894,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/signalR/{resourceName}/restart'} # type: ignore + @distributed_trace_async async def list_skus( self, resource_group_name: str, @@ -994,33 +921,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 +946,6 @@ async def list_skus( return cls(pipeline_response, deserialized, {}) return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus'} # type: ignore + diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py index ed7b08643ce24..4fd05a5a8d75b 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_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._signal_rprivate_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.signalr.models.PrivateEndpointConnectionList] + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.signalr.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/signalR/{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/signalR/{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/signalR/{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/signalR/{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/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py index bc3e1f4a243ae..ff7533bab4a33 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_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._signal_rprivate_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.signalr.models.PrivateLinkResourceList] + :return: An iterator like instance of either PrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.signalr.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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py index 2a70e20bc36d5..07cbd131abf0a 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_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._signal_rshared_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.signalr.models.SharedPrivateLinkResourceList] + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.signalr.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/signalR/{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/signalR/{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/signalR/{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.signalr.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.signalr.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.signalr.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/signalR/{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/signalR/{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/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py index b3defc85405c9..aa1860efef37d 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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, @@ -60,35 +66,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('SignalRUsageList', pipeline_response) + deserialized = self._deserialize("SignalRUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +103,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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py index e1b1d8d2d5f2d..f4f4fffa249c6 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py @@ -6,112 +6,59 @@ # 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 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 ServerlessUpstreamSettings - 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 SignalRCorsSettings - from ._models_py3 import SignalRFeature - from ._models_py3 import SignalRKeys - from ._models_py3 import SignalRNetworkACLs - from ._models_py3 import SignalRResource - from ._models_py3 import SignalRResourceList - from ._models_py3 import SignalRTlsSettings - from ._models_py3 import SignalRUsage - from ._models_py3 import SignalRUsageList - from ._models_py3 import SignalRUsageName - 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 UpstreamTemplate - from ._models_py3 import UserAssignedIdentityProperty -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 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 ServerlessUpstreamSettings # 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 SignalRCorsSettings # type: ignore - from ._models import SignalRFeature # type: ignore - from ._models import SignalRKeys # type: ignore - from ._models import SignalRNetworkACLs # type: ignore - from ._models import SignalRResource # type: ignore - from ._models import SignalRResourceList # type: ignore - from ._models import SignalRTlsSettings # type: ignore - from ._models import SignalRUsage # type: ignore - from ._models import SignalRUsageList # type: ignore - from ._models import SignalRUsageName # 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 UpstreamTemplate # type: ignore - from ._models import UserAssignedIdentityProperty # 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 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 ServerlessUpstreamSettings +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 SignalRCorsSettings +from ._models_py3 import SignalRFeature +from ._models_py3 import SignalRKeys +from ._models_py3 import SignalRNetworkACLs +from ._models_py3 import SignalRResource +from ._models_py3 import SignalRResourceList +from ._models_py3 import SignalRTlsSettings +from ._models_py3 import SignalRUsage +from ._models_py3 import SignalRUsageList +from ._models_py3 import SignalRUsageName +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 UpstreamTemplate +from ._models_py3 import UserAssignedIdentityProperty + from ._signal_rmanagement_client_enums import ( ACLAction, diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py deleted file mode 100644 index 1141dda2a3e1c..0000000000000 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py +++ /dev/null @@ -1,1831 +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.signalr.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.signalr.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.signalr.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 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.signalr.models.ManagedIdentityType - :param user_assigned_identities: Get or set the user assigned identities. - :type user_assigned_identities: dict[str, - ~azure.mgmt.signalr.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.signalr.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.signalr.models.SignalRRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] - """ - - _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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.models.SignalRRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, - ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] - :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.signalr.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.signalr.models.ProvisioningState - :param private_endpoint: Private endpoint associated with the private endpoint connection. - :type private_endpoint: ~azure.mgmt.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.models.SignalRSkuTier - :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 ServerlessUpstreamSettings(msrest.serialization.Model): - """The settings for the Upstream when the service is in server-less mode. - - :param templates: Gets or sets the list of Upstream URL templates. Order matters, and the first - matching template takes effects. - :type templates: list[~azure.mgmt.signalr.models.UpstreamTemplate] - """ - - _attribute_map = { - 'templates': {'key': 'templates', 'type': '[UpstreamTemplate]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerlessUpstreamSettings, self).__init__(**kwargs) - self.templates = kwargs.get('templates', 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.signalr.models.MetricSpecification] - :param log_specifications: Specifications of the Logs for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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 SignalRCorsSettings(msrest.serialization.Model): - """Cross-Origin Resource Sharing (CORS) settings. - - :param allowed_origins: Gets or sets the list of origins that should be allowed to make - cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, - allow all by default. - :type allowed_origins: list[str] - """ - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRCorsSettings, self).__init__(**kwargs) - self.allowed_origins = kwargs.get('allowed_origins', None) - - -class SignalRFeature(msrest.serialization.Model): - """Feature of a resource, which controls the runtime behavior. - - All required parameters must be populated in order to send to Azure. - - :param flag: Required. FeatureFlags is the supported features of Azure SignalR service. - - - * ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have - your own backend server; "Serverless": your application doesn't have a backend server; - "Classic": for backward compatibility. Support both Default and Serverless mode but not - recommended; "PredefinedOnly": for future use. - * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category - respectively. - * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category - respectively. - * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR - service, it will give you live traces in real time, it will be helpful when you developing your - own Azure SignalR based web application or self-troubleshooting some issues. Please note that - live traces are counted as outbound messages that will be charged. Values allowed: - "true"/"false", to enable/disable live trace feature. Possible values include: "ServiceMode", - "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". - :type flag: str or ~azure.mgmt.signalr.models.FeatureFlags - :param value: Required. Value of the feature flag. See Azure SignalR service document - https://docs.microsoft.com/azure/azure-signalr/ for allowed values. - :type value: str - :param properties: Optional properties related to this feature. - :type properties: dict[str, str] - """ - - _validation = { - 'flag': {'required': True}, - 'value': {'required': True, 'max_length': 128, 'min_length': 1}, - } - - _attribute_map = { - 'flag': {'key': 'flag', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRFeature, self).__init__(**kwargs) - self.flag = kwargs['flag'] - self.value = kwargs['value'] - self.properties = kwargs.get('properties', None) - - -class SignalRKeys(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(SignalRKeys, 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 SignalRNetworkACLs(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.signalr.models.ACLAction - :param public_network: ACL for requests from public network. - :type public_network: ~azure.mgmt.signalr.models.NetworkACL - :param private_endpoints: ACLs for requests from private endpoints. - :type private_endpoints: list[~azure.mgmt.signalr.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(SignalRNetworkACLs, 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 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 SignalRResource(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.signalr.models.ResourceSku - :param kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". - Possible values include: "SignalR", "RawWebSockets". - :type kind: str or ~azure.mgmt.signalr.models.ServiceKind - :param identity: The managed identity response. - :type identity: ~azure.mgmt.signalr.models.ManagedIdentity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.signalr.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.signalr.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.signalr.models.PrivateEndpointConnection] - :ivar shared_private_link_resources: The list of shared private link resources. - :vartype shared_private_link_resources: - list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] - :param tls: TLS settings. - :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings - :ivar host_name_prefix: Deprecated. - :vartype host_name_prefix: str - :param features: List of the featureFlags. - - FeatureFlags that are not included in the parameters for the update operation will not be - modified. - And the response will only include featureFlags that are explicitly set. - When a featureFlag is not explicitly set, its globally default value will be used - But keep in mind, the default value doesn't mean "false". It varies in terms of different - FeatureFlags. - :type features: list[~azure.mgmt.signalr.models.SignalRFeature] - :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.signalr.models.ResourceLogConfiguration - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the service is in server-less mode. - :type upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings - :param network_ac_ls: Network ACLs. - :type network_ac_ls: ~azure.mgmt.signalr.models.SignalRNetworkACLs - :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'}, - 'kind': {'key': 'kind', 'type': 'str'}, - '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': 'SignalRTlsSettings'}, - 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, - 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, - 'resource_log_configuration': {'key': 'properties.resourceLogConfiguration', 'type': 'ResourceLogConfiguration'}, - 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'SignalRNetworkACLs'}, - '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(SignalRResource, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.kind = kwargs.get('kind', 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.features = kwargs.get('features', None) - self.resource_log_configuration = kwargs.get('resource_log_configuration', None) - self.cors = kwargs.get('cors', None) - self.upstream = kwargs.get('upstream', 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 SignalRResourceList(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.signalr.models.SignalRResource] - :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': '[SignalRResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SignalRTlsSettings(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(SignalRTlsSettings, self).__init__(**kwargs) - self.client_cert_enabled = kwargs.get('client_cert_enabled', True) - - -class SignalRUsage(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.signalr.models.SignalRUsageName - :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': 'SignalRUsageName'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRUsage, 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 SignalRUsageList(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.signalr.models.SignalRUsage] - :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': '[SignalRUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRUsageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SignalRUsageName(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(SignalRUsageName, 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.signalr.models.ResourceSku - :ivar capacity: Specifies the unit of the resource. - :vartype capacity: ~azure.mgmt.signalr.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.signalr.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.signalr.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.signalr.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.signalr.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 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.signalr.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.signalr.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 UpstreamTemplate(msrest.serialization.Model): - """Upstream template item settings. It defines the Upstream URL of the incoming requests. -The template defines the pattern of the event, the hub or the category of the incoming request that matches current URL template. - - All required parameters must be populated in order to send to Azure. - - :param hub_pattern: Gets or sets the matching pattern for hub names. If not set, it matches any - hub. - There are 3 kind of patterns supported: - - .. code-block:: - - 1. "*", it to matches any hub name - 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" - 3. The single hub name, for example, "hub1", it matches "hub1". - :type hub_pattern: str - :param event_pattern: Gets or sets the matching pattern for event names. If not set, it matches - any event. - There are 3 kind of patterns supported: - - .. code-block:: - - 1. "*", it to matches any event name - 2. Combine multiple events with ",", for example "connect,disconnect", it matches event - "connect" and "disconnect" - 3. The single event name, for example, "connect", it matches "connect". - :type event_pattern: str - :param category_pattern: Gets or sets the matching pattern for category names. If not set, it - matches any category. - There are 3 kind of patterns supported: - - .. code-block:: - - 1. "*", it to matches any category name - 2. Combine multiple categories with ",", for example "connections,messages", it matches - category "connections" and "messages" - 3. The single category name, for example, "connections", it matches the category - "connections". - :type category_pattern: str - :param url_template: Required. Gets or sets the Upstream URL template. You can use 3 predefined - parameters {hub}, {category} {event} inside the template, the value of the Upstream URL is - dynamically calculated when the client request comes in. - For example, if the urlTemplate is ``http://example.com/{hub}/api/{event}``\ , with a client - request from hub ``chat`` connects, it will first POST to this URL: - ``http://example.com/chat/api/connect``. - :type url_template: str - :param auth: Gets or sets the auth settings for an upstream. If not set, no auth is used for - upstream messages. - :type auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings - """ - - _validation = { - 'url_template': {'required': True}, - } - - _attribute_map = { - 'hub_pattern': {'key': 'hubPattern', 'type': 'str'}, - 'event_pattern': {'key': 'eventPattern', 'type': 'str'}, - 'category_pattern': {'key': 'categoryPattern', 'type': 'str'}, - 'url_template': {'key': 'urlTemplate', 'type': 'str'}, - 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(UpstreamTemplate, self).__init__(**kwargs) - self.hub_pattern = kwargs.get('hub_pattern', None) - self.event_pattern = kwargs.get('event_pattern', None) - self.category_pattern = kwargs.get('category_pattern', None) - self.url_template = kwargs['url_template'] - self.auth = kwargs.get('auth', 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 diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py index e019dca6fb79b..b158fd6153171 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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.signalr.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.signalr.models.ErrorDetail """ _attribute_map = { @@ -144,6 +159,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.signalr.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -151,10 +170,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 = { @@ -169,6 +188,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 @@ -179,11 +204,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.signalr.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.signalr.models.ManagedIdentityType + :ivar user_assigned_identities: Get or set the user assigned identities. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.signalr.models.UserAssignedIdentityProperty] :ivar principal_id: Get the principal id for the system assigned identity. Only be used in response. @@ -212,6 +237,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.signalr.models.ManagedIdentityType + :keyword user_assigned_identities: Get or set the user assigned identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.signalr.models.UserAssignedIdentityProperty] + """ super(ManagedIdentity, self).__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities @@ -222,9 +255,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 = { @@ -237,6 +270,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 @@ -244,29 +282,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.signalr.models.Dimension] + :vartype category: str + :ivar dimensions: The dimensions of the metrics. + :vartype dimensions: list[~azure.mgmt.signalr.models.Dimension] """ _attribute_map = { @@ -293,6 +331,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.signalr.models.Dimension] + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -307,12 +370,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 = { @@ -329,6 +392,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 @@ -340,11 +411,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 = { @@ -364,6 +435,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 @@ -372,12 +450,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.signalr.models.SignalRRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, + :vartype allow: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + :ivar deny: Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + :vartype deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] """ _attribute_map = { @@ -392,6 +470,14 @@ def __init__( deny: Optional[List[Union[str, "SignalRRequestType"]]] = 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.signalr.models.SignalRRequestType] + :keyword deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + """ super(NetworkACL, self).__init__(**kwargs) self.allow = allow self.deny = deny @@ -400,17 +486,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.signalr.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.signalr.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.signalr.models.OperationProperties + :vartype origin: str + :ivar properties: Extra Operation properties. + :vartype properties: ~azure.mgmt.signalr.models.OperationProperties """ _attribute_map = { @@ -431,6 +517,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.signalr.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.signalr.models.OperationProperties + """ super(Operation, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -442,14 +541,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 = { @@ -468,6 +567,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 @@ -478,12 +587,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.signalr.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.signalr.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 = { @@ -498,6 +606,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.signalr.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 @@ -506,8 +622,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: The service specifications. - :type service_specification: ~azure.mgmt.signalr.models.ServiceSpecification + :ivar service_specification: An object that describes a specification. + :vartype service_specification: ~azure.mgmt.signalr.models.ServiceSpecification """ _attribute_map = { @@ -520,6 +636,10 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: An object that describes a specification. + :paramtype service_specification: ~azure.mgmt.signalr.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -527,8 +647,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 = { @@ -541,6 +661,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 @@ -550,14 +674,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.signalr.models.SignalRRequestType] - :param deny: Denied request types. The value can be one or more of: ClientConnection, + :vartype allow: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + :ivar deny: Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. - :type deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] - :param name: Required. Name of the private endpoint connection. - :type name: str + :vartype deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + :ivar name: Required. Name of the private endpoint connection. + :vartype name: str """ _validation = { @@ -578,6 +702,16 @@ def __init__( deny: Optional[List[Union[str, "SignalRRequestType"]]] = 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.signalr.models.SignalRRequestType] + :keyword deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :paramtype deny: list[str or ~azure.mgmt.signalr.models.SignalRRequestType] + :keyword name: Required. Name of the private endpoint connection. + :paramtype name: str + """ super(PrivateEndpointACL, self).__init__(allow=allow, deny=deny, **kwargs) self.name = name @@ -611,6 +745,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -646,6 +782,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -662,16 +800,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.signalr.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.signalr.models.ProvisioningState - :param private_endpoint: Private endpoint associated with the private endpoint connection. - :type private_endpoint: ~azure.mgmt.signalr.models.PrivateEndpoint + :ivar private_endpoint: Private endpoint. + :vartype private_endpoint: ~azure.mgmt.signalr.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.signalr.models.PrivateLinkServiceConnectionState """ @@ -702,6 +841,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: Private endpoint. + :paramtype private_endpoint: ~azure.mgmt.signalr.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state of the private endpoint + connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.signalr.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.system_data = None self.provisioning_state = None @@ -713,12 +860,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.signalr.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.signalr.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 = { @@ -733,6 +880,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of the private endpoint connections. + :paramtype value: list[~azure.mgmt.signalr.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 @@ -749,15 +904,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.signalr.models.ShareablePrivateLinkResourceType] """ @@ -786,6 +941,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.signalr.models.ShareablePrivateLinkResourceType] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = group_id self.required_members = required_members @@ -796,12 +963,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.signalr.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.signalr.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 = { @@ -816,6 +982,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of PrivateLinkResource. + :paramtype value: list[~azure.mgmt.signalr.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 @@ -824,14 +998,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.signalr.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.signalr.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 = { @@ -848,6 +1022,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.signalr.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 @@ -857,9 +1042,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.signalr.models.KeyType + :ivar key_type: The type of access key. Possible values include: "Primary", "Secondary", + "Salt". + :vartype key_type: str or ~azure.mgmt.signalr.models.KeyType """ _attribute_map = { @@ -872,6 +1057,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.signalr.models.KeyType + """ super(RegenerateKeyParameters, self).__init__(**kwargs) self.key_type = key_type @@ -879,14 +1069,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 = { @@ -901,6 +1091,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 @@ -909,8 +1109,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.signalr.models.ResourceLogCategory] + :ivar categories: Gets or sets the list of category configurations. + :vartype categories: list[~azure.mgmt.signalr.models.ResourceLogCategory] """ _attribute_map = { @@ -923,6 +1123,10 @@ def __init__( categories: Optional[List["ResourceLogCategory"]] = None, **kwargs ): + """ + :keyword categories: Gets or sets the list of category configurations. + :paramtype categories: list[~azure.mgmt.signalr.models.ResourceLogCategory] + """ super(ResourceLogConfiguration, self).__init__(**kwargs) self.categories = categories @@ -934,25 +1138,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.signalr.models.SignalRSkuTier + :vartype tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier :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 = { @@ -977,6 +1181,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.signalr.models.SignalRSkuTier + :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 @@ -988,9 +1209,9 @@ def __init__( class ServerlessUpstreamSettings(msrest.serialization.Model): """The settings for the Upstream when the service is in server-less mode. - :param templates: Gets or sets the list of Upstream URL templates. Order matters, and the first + :ivar templates: Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. - :type templates: list[~azure.mgmt.signalr.models.UpstreamTemplate] + :vartype templates: list[~azure.mgmt.signalr.models.UpstreamTemplate] """ _attribute_map = { @@ -1003,6 +1224,11 @@ def __init__( templates: Optional[List["UpstreamTemplate"]] = None, **kwargs ): + """ + :keyword templates: Gets or sets the list of Upstream URL templates. Order matters, and the + first matching template takes effects. + :paramtype templates: list[~azure.mgmt.signalr.models.UpstreamTemplate] + """ super(ServerlessUpstreamSettings, self).__init__(**kwargs) self.templates = templates @@ -1010,10 +1236,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.signalr.models.MetricSpecification] - :param log_specifications: Specifications of the Logs for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.signalr.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.signalr.models.MetricSpecification] + :ivar log_specifications: Specifications of the Logs for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.signalr.models.LogSpecification] """ _attribute_map = { @@ -1028,6 +1254,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.signalr.models.MetricSpecification] + :keyword log_specifications: Specifications of the Logs for Azure Monitoring. + :paramtype log_specifications: list[~azure.mgmt.signalr.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -1036,15 +1268,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 = { @@ -1061,6 +1293,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 @@ -1070,11 +1313,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.signalr.models.ShareablePrivateLinkResourceProperties + :vartype properties: ~azure.mgmt.signalr.models.ShareablePrivateLinkResourceProperties """ _attribute_map = { @@ -1089,6 +1332,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.signalr.models.ShareablePrivateLinkResourceProperties + """ super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) self.name = name self.properties = properties @@ -1107,19 +1357,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.signalr.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.signalr.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.signalr.models.SharedPrivateLinkResourceStatus @@ -1154,6 +1404,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 @@ -1166,12 +1427,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.signalr.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.signalr.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 = { @@ -1186,6 +1447,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of the shared private link resources. + :paramtype value: list[~azure.mgmt.signalr.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 @@ -1194,10 +1463,10 @@ def __init__( class SignalRCorsSettings(msrest.serialization.Model): """Cross-Origin Resource Sharing (CORS) settings. - :param allowed_origins: Gets or sets the list of origins that should be allowed to make + :ivar allowed_origins: Gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. - :type allowed_origins: list[str] + :vartype allowed_origins: list[str] """ _attribute_map = { @@ -1210,6 +1479,12 @@ def __init__( allowed_origins: Optional[List[str]] = None, **kwargs ): + """ + :keyword allowed_origins: Gets or sets the list of origins that should be allowed to make + cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, + allow all by default. + :paramtype allowed_origins: list[str] + """ super(SignalRCorsSettings, self).__init__(**kwargs) self.allowed_origins = allowed_origins @@ -1219,7 +1494,7 @@ class SignalRFeature(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param flag: Required. FeatureFlags is the supported features of Azure SignalR service. + :ivar flag: Required. FeatureFlags is the supported features of Azure SignalR service. * ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have @@ -1236,12 +1511,12 @@ class SignalRFeature(msrest.serialization.Model): live traces are counted as outbound messages that will be charged. Values allowed: "true"/"false", to enable/disable live trace feature. Possible values include: "ServiceMode", "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". - :type flag: str or ~azure.mgmt.signalr.models.FeatureFlags - :param value: Required. Value of the feature flag. See Azure SignalR service document + :vartype flag: str or ~azure.mgmt.signalr.models.FeatureFlags + :ivar value: Required. Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. - :type value: str - :param properties: Optional properties related to this feature. - :type properties: dict[str, str] + :vartype value: str + :ivar properties: Optional properties related to this feature. + :vartype properties: dict[str, str] """ _validation = { @@ -1263,6 +1538,31 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword flag: Required. FeatureFlags is the supported features of Azure SignalR service. + + + * ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have + your own backend server; "Serverless": your application doesn't have a backend server; + "Classic": for backward compatibility. Support both Default and Serverless mode but not + recommended; "PredefinedOnly": for future use. + * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR + service, it will give you live traces in real time, it will be helpful when you developing your + own Azure SignalR based web application or self-troubleshooting some issues. Please note that + live traces are counted as outbound messages that will be charged. Values allowed: + "true"/"false", to enable/disable live trace feature. Possible values include: "ServiceMode", + "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". + :paramtype flag: str or ~azure.mgmt.signalr.models.FeatureFlags + :keyword value: Required. Value of the feature flag. See Azure SignalR service document + https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + :paramtype value: str + :keyword properties: Optional properties related to this feature. + :paramtype properties: dict[str, str] + """ super(SignalRFeature, self).__init__(**kwargs) self.flag = flag self.value = value @@ -1272,14 +1572,14 @@ def __init__( class SignalRKeys(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 = { @@ -1298,6 +1598,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(SignalRKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -1308,13 +1618,12 @@ def __init__( class SignalRNetworkACLs(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.signalr.models.ACLAction - :param public_network: ACL for requests from public network. - :type public_network: ~azure.mgmt.signalr.models.NetworkACL - :param private_endpoints: ACLs for requests from private endpoints. - :type private_endpoints: list[~azure.mgmt.signalr.models.PrivateEndpointACL] + :ivar default_action: Azure Networking ACL Action. Possible values include: "Allow", "Deny". + :vartype default_action: str or ~azure.mgmt.signalr.models.ACLAction + :ivar public_network: Network ACL. + :vartype public_network: ~azure.mgmt.signalr.models.NetworkACL + :ivar private_endpoints: ACLs for requests from private endpoints. + :vartype private_endpoints: list[~azure.mgmt.signalr.models.PrivateEndpointACL] """ _attribute_map = { @@ -1331,6 +1640,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.signalr.models.ACLAction + :keyword public_network: Network ACL. + :paramtype public_network: ~azure.mgmt.signalr.models.NetworkACL + :keyword private_endpoints: ACLs for requests from private endpoints. + :paramtype private_endpoints: list[~azure.mgmt.signalr.models.PrivateEndpointACL] + """ super(SignalRNetworkACLs, self).__init__(**kwargs) self.default_action = default_action self.public_network = public_network @@ -1348,12 +1665,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 = { @@ -1377,6 +1694,14 @@ 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 @@ -1393,19 +1718,19 @@ class SignalRResource(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.signalr.models.ResourceSku - :param kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". - Possible values include: "SignalR", "RawWebSockets". - :type kind: str or ~azure.mgmt.signalr.models.ServiceKind - :param identity: The managed identity response. - :type identity: ~azure.mgmt.signalr.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.signalr.models.ResourceSku + :ivar kind: The kind of the service, it can be SignalR or RawWebSockets. Possible values + include: "SignalR", "RawWebSockets". + :vartype kind: str or ~azure.mgmt.signalr.models.ServiceKind + :ivar identity: A class represent managed identities used for request and response. + :vartype identity: ~azure.mgmt.signalr.models.ManagedIdentity :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: @@ -1431,11 +1756,11 @@ class SignalRResource(TrackedResource): :ivar shared_private_link_resources: The list of shared private link resources. :vartype shared_private_link_resources: list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] - :param tls: TLS settings. - :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings + :ivar tls: TLS settings for the resource. + :vartype tls: ~azure.mgmt.signalr.models.SignalRTlsSettings :ivar host_name_prefix: Deprecated. :vartype host_name_prefix: str - :param features: List of the featureFlags. + :ivar features: List of the featureFlags. FeatureFlags that are not included in the parameters for the update operation will not be modified. @@ -1443,32 +1768,29 @@ class SignalRResource(TrackedResource): When a featureFlag is not explicitly set, its globally default value will be used But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. - :type features: list[~azure.mgmt.signalr.models.SignalRFeature] - :param resource_log_configuration: Resource log configuration of a Microsoft.SignalRService + :vartype features: list[~azure.mgmt.signalr.models.SignalRFeature] + :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.signalr.models.ResourceLogConfiguration - :param cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the service is in server-less mode. - :type upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings - :param network_ac_ls: Network ACLs. - :type network_ac_ls: ~azure.mgmt.signalr.models.SignalRNetworkACLs - :param public_network_access: Enable or disable public network access. Default to "Enabled". + :vartype resource_log_configuration: ~azure.mgmt.signalr.models.ResourceLogConfiguration + :ivar cors: Cross-Origin Resource Sharing (CORS) settings. + :vartype cors: ~azure.mgmt.signalr.models.SignalRCorsSettings + :ivar upstream: The settings for the Upstream when the service is in server-less mode. + :vartype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :ivar network_ac_ls: Network ACLs for the resource. + :vartype network_ac_ls: ~azure.mgmt.signalr.models.SignalRNetworkACLs + :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 = { @@ -1536,6 +1858,54 @@ 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.signalr.models.ResourceSku + :keyword kind: The kind of the service, it can be SignalR or RawWebSockets. Possible values + include: "SignalR", "RawWebSockets". + :paramtype kind: str or ~azure.mgmt.signalr.models.ServiceKind + :keyword identity: A class represent managed identities used for request and response. + :paramtype identity: ~azure.mgmt.signalr.models.ManagedIdentity + :keyword tls: TLS settings for the resource. + :paramtype tls: ~azure.mgmt.signalr.models.SignalRTlsSettings + :keyword features: List of the featureFlags. + + FeatureFlags that are not included in the parameters for the update operation will not be + modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, its globally default value will be used + But keep in mind, the default value doesn't mean "false". It varies in terms of different + FeatureFlags. + :paramtype features: list[~azure.mgmt.signalr.models.SignalRFeature] + :keyword resource_log_configuration: Resource log configuration of a Microsoft.SignalRService + resource. + :paramtype resource_log_configuration: ~azure.mgmt.signalr.models.ResourceLogConfiguration + :keyword cors: Cross-Origin Resource Sharing (CORS) settings. + :paramtype cors: ~azure.mgmt.signalr.models.SignalRCorsSettings + :keyword upstream: The settings for the Upstream when the service is in server-less mode. + :paramtype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :keyword network_ac_ls: Network ACLs for the resource. + :paramtype network_ac_ls: ~azure.mgmt.signalr.models.SignalRNetworkACLs + :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(SignalRResource, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.kind = kind @@ -1564,12 +1934,11 @@ def __init__( class SignalRResourceList(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.signalr.models.SignalRResource] - :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.signalr.models.SignalRResource] + :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 = { @@ -1584,6 +1953,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of the resources. + :paramtype value: list[~azure.mgmt.signalr.models.SignalRResource] + :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(SignalRResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1592,8 +1969,8 @@ def __init__( class SignalRTlsSettings(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 = { @@ -1606,6 +1983,10 @@ 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(SignalRTlsSettings, self).__init__(**kwargs) self.client_cert_enabled = client_cert_enabled @@ -1613,18 +1994,18 @@ def __init__( class SignalRUsage(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.signalr.models.SignalRUsageName - :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.signalr.models.SignalRUsageName + :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 = { @@ -1645,6 +2026,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.signalr.models.SignalRUsageName + :keyword unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :paramtype unit: str + """ super(SignalRUsage, self).__init__(**kwargs) self.id = id self.current_value = current_value @@ -1656,12 +2051,11 @@ def __init__( class SignalRUsageList(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.signalr.models.SignalRUsage] - :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.signalr.models.SignalRUsage] + :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 = { @@ -1676,6 +2070,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of the resource usages. + :paramtype value: list[~azure.mgmt.signalr.models.SignalRUsage] + :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(SignalRUsageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1684,10 +2086,10 @@ def __init__( class SignalRUsageName(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 = { @@ -1702,6 +2104,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(SignalRUsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -1714,9 +2122,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.signalr.models.ResourceSku - :ivar capacity: Specifies the unit of the resource. + :ivar capacity: Describes scaling information of a sku. :vartype capacity: ~azure.mgmt.signalr.models.SkuCapacity """ @@ -1736,6 +2144,8 @@ def __init__( self, **kwargs ): + """ + """ super(Sku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -1780,6 +2190,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -1814,6 +2226,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1822,20 +2236,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.signalr.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.signalr.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.signalr.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.signalr.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1858,6 +2272,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.signalr.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.signalr.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 @@ -1868,14 +2298,12 @@ def __init__( 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.signalr.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.signalr.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.signalr.models.UpstreamAuthType + :ivar managed_identity: Managed identity settings for upstream. + :vartype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings """ _attribute_map = { @@ -1890,6 +2318,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.signalr.models.UpstreamAuthType + :keyword managed_identity: Managed identity settings for upstream. + :paramtype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings + """ super(UpstreamAuthSettings, self).__init__(**kwargs) self.type = type self.managed_identity = managed_identity @@ -1901,7 +2335,7 @@ class UpstreamTemplate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param hub_pattern: Gets or sets the matching pattern for hub names. If not set, it matches any + :ivar hub_pattern: Gets or sets the matching pattern for hub names. If not set, it matches any hub. There are 3 kind of patterns supported: @@ -1910,8 +2344,8 @@ class UpstreamTemplate(msrest.serialization.Model): 1. "*", it to matches any hub name 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" 3. The single hub name, for example, "hub1", it matches "hub1". - :type hub_pattern: str - :param event_pattern: Gets or sets the matching pattern for event names. If not set, it matches + :vartype hub_pattern: str + :ivar event_pattern: Gets or sets the matching pattern for event names. If not set, it matches any event. There are 3 kind of patterns supported: @@ -1921,8 +2355,8 @@ class UpstreamTemplate(msrest.serialization.Model): 2. Combine multiple events with ",", for example "connect,disconnect", it matches event "connect" and "disconnect" 3. The single event name, for example, "connect", it matches "connect". - :type event_pattern: str - :param category_pattern: Gets or sets the matching pattern for category names. If not set, it + :vartype event_pattern: str + :ivar category_pattern: Gets or sets the matching pattern for category names. If not set, it matches any category. There are 3 kind of patterns supported: @@ -1933,17 +2367,16 @@ class UpstreamTemplate(msrest.serialization.Model): category "connections" and "messages" 3. The single category name, for example, "connections", it matches the category "connections". - :type category_pattern: str - :param url_template: Required. Gets or sets the Upstream URL template. You can use 3 predefined + :vartype category_pattern: str + :ivar url_template: Required. Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} {event} inside the template, the value of the Upstream URL is dynamically calculated when the client request comes in. For example, if the urlTemplate is ``http://example.com/{hub}/api/{event}``\ , with a client request from hub ``chat`` connects, it will first POST to this URL: ``http://example.com/chat/api/connect``. - :type url_template: str - :param auth: Gets or sets the auth settings for an upstream. If not set, no auth is used for - upstream messages. - :type auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings + :vartype url_template: str + :ivar auth: Upstream auth settings. If not set, no auth is used for upstream messages. + :vartype auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings """ _validation = { @@ -1968,6 +2401,50 @@ def __init__( auth: Optional["UpstreamAuthSettings"] = None, **kwargs ): + """ + :keyword hub_pattern: Gets or sets the matching pattern for hub names. If not set, it matches + any hub. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any hub name + 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" + 3. The single hub name, for example, "hub1", it matches "hub1". + :paramtype hub_pattern: str + :keyword event_pattern: Gets or sets the matching pattern for event names. If not set, it + matches any event. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any event name + 2. Combine multiple events with ",", for example "connect,disconnect", it matches event + "connect" and "disconnect" + 3. The single event name, for example, "connect", it matches "connect". + :paramtype event_pattern: str + :keyword category_pattern: Gets or sets the matching pattern for category names. If not set, it + matches any category. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any category name + 2. Combine multiple categories with ",", for example "connections,messages", it matches + category "connections" and "messages" + 3. The single category name, for example, "connections", it matches the category + "connections". + :paramtype category_pattern: str + :keyword url_template: Required. Gets or sets the Upstream URL template. You can use 3 + predefined parameters {hub}, {category} {event} inside the template, the value of the Upstream + URL is dynamically calculated when the client request comes in. + For example, if the urlTemplate is ``http://example.com/{hub}/api/{event}``\ , with a client + request from hub ``chat`` connects, it will first POST to this URL: + ``http://example.com/chat/api/connect``. + :paramtype url_template: str + :keyword auth: Upstream auth settings. If not set, no auth is used for upstream messages. + :paramtype auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings + """ super(UpstreamTemplate, self).__init__(**kwargs) self.hub_pattern = hub_pattern self.event_pattern = event_pattern @@ -2001,6 +2478,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentityProperty, self).__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py index 2ce46e801b80b..cf7aa123655af 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_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,7 +27,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FeatureFlags(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """FeatureFlags is the supported features of Azure SignalR service. @@ -66,23 +51,23 @@ class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLE_MESSAGING_LOGS = "EnableMessagingLogs" ENABLE_LIVE_TRACE = "EnableLiveTrace" -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. """ @@ -92,7 +77,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. """ @@ -106,7 +91,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. """ @@ -114,14 +99,14 @@ class ScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR" +class ServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The kind of the service, it can be SignalR or RawWebSockets """ SIGNAL_R = "SignalR" RAW_WEB_SOCKETS = "RawWebSockets" -class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharedPrivateLinkResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the shared private link resource """ @@ -131,9 +116,8 @@ class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, s DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class SignalRRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, - RESTAPI. +class SignalRRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The incoming request type to the service """ CLIENT_CONNECTION = "ClientConnection" @@ -141,7 +125,7 @@ class SignalRRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTAPI = "RESTAPI" TRACE = "Trace" -class SignalRSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignalRSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Optional tier of this particular SKU. 'Standard' or 'Free'. ``Basic`` is deprecated, use ``Standard`` instead. @@ -152,8 +136,8 @@ class SignalRSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -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" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py index b108ff5d60619..396e8a59df5bc 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py index a81113e9cac06..85ffcd5fde080 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_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/signalR') + 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/signalR') + 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/signalR/{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/signalR/{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/signalR/{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/signalR/{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/signalR/{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/signalR/{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/signalR/{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/signalR/{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 SignalROperations(object): """SignalROperations 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,13 +515,15 @@ 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.SignalRResourceList"] + **kwargs: Any + ) -> Iterable["_models.SignalRResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -128,34 +536,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('SignalRResourceList', pipeline_response) + deserialized = self._deserialize("SignalRResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,23 +571,24 @@ 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/signalR'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SignalRResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SignalRResourceList"]: """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 @@ -200,35 +604,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('SignalRResourceList', pipeline_response) + deserialized = self._deserialize("SignalRResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -241,24 +641,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/signalR'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SignalRResource" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.SignalRResource": """Get the resource and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -276,33 +677,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('SignalRResource', pipeline_response) @@ -311,54 +702,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SignalRResource" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.SignalRResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.SignalRResource", + **kwargs: Any + ) -> Optional["_models.SignalRResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] 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, 'SignalRResource') + + 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, 'SignalRResource') - 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 +752,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/signalR/{resourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SignalRResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SignalRResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.SignalRResource", + **kwargs: Any + ) -> LROPoller["_models.SignalRResource"]: """Create or update a resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -392,15 +775,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.signalr.models.SignalRResource :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 SignalRResource 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 SignalRResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SignalRResource] - :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.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,27 +799,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('SignalRResource', 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 +825,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/signalR/{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/signalR/{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 +879,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 +903,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 +922,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/signalR/{resourceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SignalRResource" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.SignalRResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.SignalRResource", + **kwargs: Any + ) -> Optional["_models.SignalRResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] 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, 'SignalRResource') + + 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, 'SignalRResource') - 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 +968,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.SignalRResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SignalRResource"] + resource_group_name: str, + resource_name: str, + parameters: "_models.SignalRResource", + **kwargs: Any + ) -> LROPoller["_models.SignalRResource"]: """Operation to update an exiting resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -634,15 +991,19 @@ def begin_update( :type parameters: ~azure.mgmt.signalr.models.SignalRResource :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 SignalRResource 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 SignalRResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SignalRResource] - :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.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -654,27 +1015,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('SignalRResource', 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 +1041,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/signalR/{resourceName}'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SignalRKeys" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.SignalRKeys": """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 +1068,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('SignalRKeys', pipeline_response) @@ -747,54 +1093,44 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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.SignalRKeys" + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs: Any + ) -> "_models.SignalRKeys": cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] 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('SignalRKeys', pipeline_response) @@ -802,16 +1138,18 @@ def _regenerate_key_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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.SignalRKeys"] + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs: Any + ) -> LROPoller["_models.SignalRKeys"]: """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. @@ -824,15 +1162,19 @@ def begin_regenerate_key( :type parameters: ~azure.mgmt.signalr.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 SignalRKeys 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 SignalRKeys or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SignalRKeys] - :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.SignalRKeys"] lro_delay = kwargs.pop( 'polling_interval', @@ -844,27 +1186,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('SignalRKeys', 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 +1212,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/signalR/{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/signalR/{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 +1266,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 +1290,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 +1309,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/signalR/{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 +1336,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 +1361,6 @@ def list_skus( return cls(pipeline_response, deserialized, {}) return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus'} # type: ignore + diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py index eb7677c02c646..c22539337efdb 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_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/signalR/{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/signalR/{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/signalR/{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/signalR/{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 SignalRPrivateEndpointConnectionsOperations(object): """SignalRPrivateEndpointConnectionsOperations 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,7 +220,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 PrivateEndpointConnectionList or the result of cls(response) + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,36 +230,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 +269,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/signalR/{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 +308,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 +334,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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 +368,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 +399,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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/signalR/{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 +459,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 +484,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 +503,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/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py index 812deefbe6531..0bb2f559498b6 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_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/signalR/{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 SignalRPrivateLinkResourcesOperations(object): """SignalRPrivateLinkResourcesOperations 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.signalr.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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py index 6f432fbf67e1d..0910ab9611970 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_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/signalR/{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/signalR/{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/signalR/{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/signalR/{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 SignalRSharedPrivateLinkResourcesOperations(object): """SignalRSharedPrivateLinkResourcesOperations 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,7 +220,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 SharedPrivateLinkResourceList or the result of cls(response) + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.SharedPrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,36 +230,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 +269,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/signalR/{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 +308,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 +334,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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 +385,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/signalR/{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 +411,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.signalr.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.signalr.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 +436,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 +462,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/signalR/{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/signalR/{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 +521,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 +546,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 +565,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/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py index 6012549d14604..9ef81237a1961 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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,12 +80,12 @@ 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.SignalRUsageList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.SignalRUsageList"]: """List resource usage quotas by location. :param location: the location like "eastus". @@ -65,35 +100,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('SignalRUsageList', pipeline_response) + deserialized = self._deserialize("SignalRUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +137,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 )