From 254708e9a519e7c322028ef958f7038421760a6f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 10 Dec 2021 03:02:18 +0000 Subject: [PATCH] CodeGen from PR 17000 in Azure/azure-rest-api-specs [Go] Track2 modify readme.go.md 9 (#17000) * [Go] Track2 modify readme.go.md 9 * fix --- sdk/signalr/azure-mgmt-signalr/_meta.json | 10 +- .../azure/mgmt/signalr/__init__.py | 9 +- .../azure/mgmt/signalr/_configuration.py | 6 +- .../azure/mgmt/signalr/_metadata.json | 21 +- .../azure/mgmt/signalr/_patch.py | 31 + .../signalr/_signal_rmanagement_client.py | 104 +- .../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/_models.py | 1013 ++++++++++++----- .../azure/mgmt/signalr/models/_models_py3.py | 1013 ++++++++++++----- .../_signal_rmanagement_client_enums.py | 45 +- .../mgmt/signalr/operations/_operations.py | 73 +- .../operations/_signal_r_operations.py | 966 ++++++++++------ ...private_endpoint_connections_operations.py | 354 ++++-- ...gnal_rprivate_link_resources_operations.py | 100 +- ...hared_private_link_resources_operations.py | 385 ++++--- .../signalr/operations/_usages_operations.py | 92 +- 27 files changed, 3608 insertions(+), 1947 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 diff --git a/sdk/signalr/azure-mgmt-signalr/_meta.json b/sdk/signalr/azure-mgmt-signalr/_meta.json index 816b6e8dac997..0aab0612abb7e 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": "2ab4371edba33c23e8d680ed2bf6f98705b5cadb", "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 --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..199f6a64c7eb8 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(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 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/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..a9ec3313817b8 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,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import 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 - + from azure.core.rest import HttpRequest, HttpResponse class SignalRManagementClient(object): """REST API for Azure SignalR Service. @@ -37,68 +32,77 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SignalRManagementClientConfiguration(credential, subscription_id, **kwargs) + 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 # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/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/_models.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py index 1141dda2a3e1c..323be1164affd 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py @@ -13,15 +13,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 = { @@ -35,6 +35,17 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -67,6 +78,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -109,6 +122,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -120,8 +135,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 = { @@ -132,6 +147,10 @@ def __init__( self, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.signalr.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = kwargs.get('error', None) @@ -139,10 +158,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 = { @@ -154,6 +173,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -164,11 +189,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: 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, + :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. @@ -194,6 +219,14 @@ def __init__( self, **kwargs ): + """ + :keyword type: Represent 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 = kwargs.get('type', None) self.user_assigned_identities = kwargs.get('user_assigned_identities', None) @@ -204,9 +237,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 = { @@ -217,6 +250,11 @@ def __init__( self, **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 = kwargs.get('resource', None) @@ -224,29 +262,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 = { @@ -264,6 +302,31 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -278,12 +341,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 = { @@ -296,6 +359,14 @@ def __init__( self, **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 = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -307,11 +378,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 = { @@ -328,6 +399,13 @@ def __init__( self, **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 = kwargs['type'] self.name = kwargs['name'] @@ -336,12 +414,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 = { @@ -353,6 +431,14 @@ def __init__( self, **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 = kwargs.get('allow', None) self.deny = kwargs.get('deny', None) @@ -361,17 +447,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 the 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 properties for the operation. + :vartype properties: ~azure.mgmt.signalr.models.OperationProperties """ _attribute_map = { @@ -386,6 +472,19 @@ def __init__( self, **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 the 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 properties for the operation. + :paramtype properties: ~azure.mgmt.signalr.models.OperationProperties + """ super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) @@ -397,14 +496,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 = { @@ -418,6 +517,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -428,12 +537,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 = { @@ -445,6 +553,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -453,8 +569,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: The service specifications. + :vartype service_specification: ~azure.mgmt.signalr.models.ServiceSpecification """ _attribute_map = { @@ -465,6 +581,10 @@ def __init__( self, **kwargs ): + """ + :keyword service_specification: The service specifications. + :paramtype service_specification: ~azure.mgmt.signalr.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) @@ -472,8 +592,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 = { @@ -484,6 +604,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: Full qualified Id of the private endpoint. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -493,14 +617,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 = { @@ -517,6 +641,16 @@ def __init__( self, **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__(**kwargs) self.name = kwargs['name'] @@ -550,6 +684,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -585,6 +721,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -605,12 +743,12 @@ class PrivateEndpointConnection(ProxyResource): 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 associated with the private endpoint connection. + :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. + :vartype private_link_service_connection_state: ~azure.mgmt.signalr.models.PrivateLinkServiceConnectionState """ @@ -638,6 +776,13 @@ def __init__( self, **kwargs ): + """ + :keyword private_endpoint: Private endpoint associated with the private endpoint connection. + :paramtype private_endpoint: ~azure.mgmt.signalr.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.signalr.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.system_data = None self.provisioning_state = None @@ -649,12 +794,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 = { @@ -666,6 +811,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -682,15 +835,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] """ @@ -714,6 +867,18 @@ def __init__( self, **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 = kwargs.get('group_id', None) self.required_members = kwargs.get('required_members', None) @@ -724,12 +889,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 = { @@ -741,6 +905,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -749,14 +921,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 = { @@ -769,6 +941,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -778,9 +961,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 + :ivar 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 + :vartype key_type: str or ~azure.mgmt.signalr.models.KeyType """ _attribute_map = { @@ -791,6 +974,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary", "Salt". + :paramtype key_type: str or ~azure.mgmt.signalr.models.KeyType + """ super(RegenerateKeyParameters, self).__init__(**kwargs) self.key_type = kwargs.get('key_type', None) @@ -798,14 +986,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 = { @@ -817,6 +1005,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.enabled = kwargs.get('enabled', None) @@ -825,8 +1023,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 = { @@ -837,6 +1035,10 @@ def __init__( self, **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 = kwargs.get('categories', None) @@ -848,25 +1050,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 = { @@ -887,6 +1089,23 @@ def __init__( self, **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 = kwargs['name'] self.tier = kwargs.get('tier', None) @@ -898,9 +1117,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 = { @@ -911,6 +1130,11 @@ def __init__( self, **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 = kwargs.get('templates', None) @@ -918,10 +1142,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 = { @@ -933,6 +1157,12 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) self.log_specifications = kwargs.get('log_specifications', None) @@ -941,15 +1171,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 = { @@ -962,6 +1192,17 @@ def __init__( self, **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 = kwargs.get('description', None) self.group_id = kwargs.get('group_id', None) @@ -971,11 +1212,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 = { @@ -987,6 +1228,13 @@ def __init__( self, **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 = kwargs.get('name', None) self.properties = kwargs.get('properties', None) @@ -1005,19 +1253,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 + :vartype 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 + :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 @@ -1048,6 +1296,17 @@ def __init__( self, **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 = kwargs.get('group_id', None) @@ -1060,12 +1319,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 = { @@ -1077,6 +1336,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1085,10 +1352,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 = { @@ -1099,6 +1366,12 @@ def __init__( self, **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 = kwargs.get('allowed_origins', None) @@ -1108,7 +1381,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 @@ -1125,12 +1398,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 = { @@ -1148,6 +1421,31 @@ def __init__( self, **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 = kwargs['flag'] self.value = kwargs['value'] @@ -1157,14 +1455,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 = { @@ -1178,6 +1476,16 @@ def __init__( self, **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 = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -1188,13 +1496,13 @@ 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: + :ivar 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] + :vartype default_action: str or ~azure.mgmt.signalr.models.ACLAction + :ivar public_network: ACL for requests from public network. + :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 = { @@ -1207,6 +1515,15 @@ def __init__( self, **kwargs ): + """ + :keyword default_action: Default action when no other rule matches. Possible values include: + "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.signalr.models.ACLAction + :keyword public_network: ACL for requests from public network. + :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 = kwargs.get('default_action', None) self.public_network = kwargs.get('public_network', None) @@ -1224,12 +1541,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 = { @@ -1250,6 +1567,14 @@ def __init__( self, **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 = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1266,19 +1591,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". + :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.(e.g. Free, Standard). + :vartype sku: ~azure.mgmt.signalr.models.ResourceSku + :ivar 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 kind: str or ~azure.mgmt.signalr.models.ServiceKind + :ivar identity: The managed identity 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: @@ -1304,11 +1629,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. + :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. @@ -1316,32 +1641,32 @@ 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: Upstream settings when the service is in server-less mode. + :vartype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :ivar network_ac_ls: Network ACLs. + :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 = { @@ -1394,6 +1719,57 @@ def __init__( self, **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.(e.g. Free, Standard). + :paramtype sku: ~azure.mgmt.signalr.models.ResourceSku + :keyword kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". + Possible values include: "SignalR", "RawWebSockets". + :paramtype kind: str or ~azure.mgmt.signalr.models.ServiceKind + :keyword identity: The managed identity response. + :paramtype identity: ~azure.mgmt.signalr.models.ManagedIdentity + :keyword tls: TLS settings. + :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. + If resourceLogConfiguration isn't null or empty, it will override options + "EnableConnectivityLog" and "EnableMessagingLogs" in features. + Otherwise, use options "EnableConnectivityLog" and "EnableMessagingLogs" in features. + :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: Upstream settings when the service is in server-less mode. + :paramtype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :keyword network_ac_ls: Network ACLs. + :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__(**kwargs) self.sku = kwargs.get('sku', None) self.kind = kwargs.get('kind', None) @@ -1422,12 +1798,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 = { @@ -1439,6 +1814,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1447,8 +1830,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 = { @@ -1459,6 +1842,10 @@ def __init__( self, **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 = kwargs.get('client_cert_enabled', True) @@ -1466,18 +1853,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 = { @@ -1492,6 +1879,20 @@ def __init__( self, **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 = kwargs.get('id', None) self.current_value = kwargs.get('current_value', None) @@ -1503,12 +1904,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 = { @@ -1520,6 +1920,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1528,10 +1936,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 = { @@ -1543,6 +1951,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.localized_value = kwargs.get('localized_value', None) @@ -1577,6 +1991,8 @@ def __init__( self, **kwargs ): + """ + """ super(Sku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -1621,6 +2037,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -1655,6 +2073,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1663,20 +2083,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 = { @@ -1692,6 +2112,22 @@ def __init__( self, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -1704,12 +2140,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 + :ivar 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 + :vartype type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :ivar 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 + :vartype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings """ _attribute_map = { @@ -1721,6 +2157,14 @@ def __init__( self, **kwargs ): + """ + :keyword type: Gets or sets the type of auth. None or ManagedIdentity is supported now. + Possible values include: "None", "ManagedIdentity". + :paramtype type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :keyword managed_identity: Gets or sets the managed identity settings. It's required if the + auth type is set to ManagedIdentity. + :paramtype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings + """ super(UpstreamAuthSettings, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.managed_identity = kwargs.get('managed_identity', None) @@ -1732,7 +2176,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: @@ -1741,8 +2185,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: @@ -1752,8 +2196,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: @@ -1764,17 +2208,17 @@ 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 + :vartype url_template: str + :ivar 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 auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings """ _validation = { @@ -1793,6 +2237,51 @@ def __init__( self, **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: Gets or sets the auth settings for an upstream. 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 = kwargs.get('hub_pattern', None) self.event_pattern = kwargs.get('event_pattern', None) @@ -1826,6 +2315,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/_models_py3.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py index e019dca6fb79b..8cb650769a980 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: 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, + :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: Represent 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 the 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 properties for the operation. + :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 the 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 properties for the operation. + :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: The service specifications. + :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: The service specifications. + :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) @@ -666,12 +804,12 @@ class PrivateEndpointConnection(ProxyResource): 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 associated with the private endpoint connection. + :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. + :vartype private_link_service_connection_state: ~azure.mgmt.signalr.models.PrivateLinkServiceConnectionState """ @@ -702,6 +840,13 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: Private endpoint associated with the private endpoint connection. + :paramtype private_endpoint: ~azure.mgmt.signalr.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state. + :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 +858,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 +878,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 +902,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 +939,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 +961,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 +980,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 +996,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 +1020,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 +1040,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 + :ivar 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 + :vartype key_type: str or ~azure.mgmt.signalr.models.KeyType """ _attribute_map = { @@ -872,6 +1055,11 @@ def __init__( key_type: Optional[Union[str, "KeyType"]] = None, **kwargs ): + """ + :keyword key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). 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 +1067,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 +1089,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 +1107,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 +1121,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 +1136,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 +1179,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 +1207,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 +1222,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 +1234,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 +1252,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 +1266,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 +1291,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 +1311,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 +1330,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 +1355,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 + :vartype 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 + :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 +1402,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 +1425,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 +1445,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 +1461,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 +1477,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 +1492,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 +1509,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 +1536,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 +1570,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 +1596,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 +1616,13 @@ 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: + :ivar 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] + :vartype default_action: str or ~azure.mgmt.signalr.models.ACLAction + :ivar public_network: ACL for requests from public network. + :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 +1639,15 @@ def __init__( private_endpoints: Optional[List["PrivateEndpointACL"]] = None, **kwargs ): + """ + :keyword default_action: Default action when no other rule matches. Possible values include: + "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.signalr.models.ACLAction + :keyword public_network: ACL for requests from public network. + :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". + :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.(e.g. Free, Standard). + :vartype sku: ~azure.mgmt.signalr.models.ResourceSku + :ivar 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 kind: str or ~azure.mgmt.signalr.models.ServiceKind + :ivar identity: The managed identity 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. + :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,32 @@ 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: Upstream settings when the service is in server-less mode. + :vartype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :ivar network_ac_ls: Network ACLs. + :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 +1861,57 @@ 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.(e.g. Free, Standard). + :paramtype sku: ~azure.mgmt.signalr.models.ResourceSku + :keyword kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". + Possible values include: "SignalR", "RawWebSockets". + :paramtype kind: str or ~azure.mgmt.signalr.models.ServiceKind + :keyword identity: The managed identity response. + :paramtype identity: ~azure.mgmt.signalr.models.ManagedIdentity + :keyword tls: TLS settings. + :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. + If resourceLogConfiguration isn't null or empty, it will override options + "EnableConnectivityLog" and "EnableMessagingLogs" in features. + Otherwise, use options "EnableConnectivityLog" and "EnableMessagingLogs" in features. + :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: Upstream settings when the service is in server-less mode. + :paramtype upstream: ~azure.mgmt.signalr.models.ServerlessUpstreamSettings + :keyword network_ac_ls: Network ACLs. + :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 +1940,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 +1959,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 +1975,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 +1989,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 +2000,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 +2032,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 +2057,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 +2076,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 +2092,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 +2110,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 @@ -1736,6 +2150,8 @@ def __init__( self, **kwargs ): + """ + """ super(Sku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -1780,6 +2196,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -1814,6 +2232,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1822,20 +2242,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 +2278,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 @@ -1870,12 +2306,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 + :ivar 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 + :vartype type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :ivar 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 + :vartype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings """ _attribute_map = { @@ -1890,6 +2326,14 @@ def __init__( managed_identity: Optional["ManagedIdentitySettings"] = None, **kwargs ): + """ + :keyword type: Gets or sets the type of auth. None or ManagedIdentity is supported now. + Possible values include: "None", "ManagedIdentity". + :paramtype type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :keyword managed_identity: Gets or sets the managed identity settings. It's required if the + auth type is set to ManagedIdentity. + :paramtype managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings + """ super(UpstreamAuthSettings, self).__init__(**kwargs) self.type = type self.managed_identity = managed_identity @@ -1901,7 +2345,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 +2354,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 +2365,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 +2377,17 @@ 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 + :vartype url_template: str + :ivar 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 auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings """ _validation = { @@ -1968,6 +2412,51 @@ 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: Gets or sets the auth settings for an upstream. 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 +2490,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..d7683a155f32a 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)): +class ACLAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Default action when no other rule matches """ 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,7 +51,7 @@ class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLE_MESSAGING_LOGS = "EnableMessagingLogs" ENABLE_LIVE_TRACE = "EnableLiveTrace" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). """ @@ -74,7 +59,7 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SECONDARY = "Secondary" SALT = "Salt" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Represent the identity type: systemAssigned, userAssigned, None """ @@ -82,7 +67,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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)): +class ServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR" """ 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,7 +116,7 @@ class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, s DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class SignalRRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SignalRRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. """ @@ -141,7 +126,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,7 +137,7 @@ class SignalRSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class UpstreamAuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpstreamAuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of auth. None or ManagedIdentity is supported now. """ 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..f63fa7cf954ae 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,30 +97,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 +130,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..af7f51f372704 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,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SignalROperations(object): """SignalROperations operations. @@ -47,6 +459,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, location, # type: str @@ -70,37 +483,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] + + _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 = 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,8 +512,11 @@ 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 @@ -128,34 +534,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,17 +569,19 @@ 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 @@ -200,35 +603,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,17 +640,19 @@ 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 @@ -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,8 +702,10 @@ 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 @@ -326,39 +719,28 @@ 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 = 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,8 +753,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -392,15 +777,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 +801,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('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,6 +827,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore def _delete_initial( @@ -458,40 +842,31 @@ 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 = 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 @@ -508,15 +883,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 +907,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,6 +926,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore def _update_initial( @@ -571,39 +942,28 @@ 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 = 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,8 +973,11 @@ 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 @@ -634,15 +997,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 +1021,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,8 +1047,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + @distributed_trace def list_keys( self, resource_group_name, # type: str @@ -712,33 +1075,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,8 +1100,10 @@ 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 @@ -762,39 +1117,28 @@ 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 = 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,8 +1146,11 @@ 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 @@ -824,15 +1171,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 +1195,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,6 +1221,7 @@ 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( @@ -890,40 +1236,31 @@ 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 = 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 @@ -940,15 +1277,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 +1301,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,8 +1320,10 @@ 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 @@ -1014,33 +1348,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 +1373,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..7f2c5a411ab30 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,26 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + private_endpoint_connection_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SignalRPrivateEndpointConnectionsOperations(object): """SignalRPrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,7 +225,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 +235,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,17 +274,19 @@ 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 @@ -151,34 +314,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,8 +340,11 @@ 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 @@ -219,39 +375,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] + + _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 = 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,8 +406,10 @@ 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 @@ -275,41 +423,32 @@ 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 = 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 @@ -329,15 +468,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 +493,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 +512,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..14a5a889031f7 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,24 +5,68 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SignalRPrivateLinkResourcesOperations(object): """SignalRPrivateLinkResourcesOperations operations. @@ -45,6 +89,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -60,7 +105,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 +115,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 +154,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..823bb48d2b565 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,26 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + shared_private_link_resource_name, # type: str + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SignalRSharedPrivateLinkResourcesOperations(object): """SignalRSharedPrivateLinkResourcesOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,7 +225,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 +235,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,17 +274,19 @@ 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 @@ -151,34 +314,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,8 +340,10 @@ 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 @@ -203,40 +358,29 @@ 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 = 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,8 +392,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, shared_private_link_resource_name, # type: str @@ -272,15 +419,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 +444,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,6 +470,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore def _delete_initial( @@ -341,41 +486,32 @@ 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 = 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 @@ -395,15 +531,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 +556,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 +575,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..a84583fe3d915 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location, # type: str @@ -65,35 +108,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 +145,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 )