diff --git a/sdk/signalr/azure-mgmt-signalr/MANIFEST.in b/sdk/signalr/azure-mgmt-signalr/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/signalr/azure-mgmt-signalr/MANIFEST.in +++ b/sdk/signalr/azure-mgmt-signalr/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/signalr/azure-mgmt-signalr/_meta.json b/sdk/signalr/azure-mgmt-signalr/_meta.json new file mode 100644 index 000000000000..11535e47c7fe --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "867165cc24d81c487ad186c998c46ba55f81c77b", + "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.6.6 --version=3.3.0", + "readme": "specification/signalr/resource-manager/readme.md" +} \ No newline at end of file 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 552b9fdcdb8d..2d686e7f49cf 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-signalr/{}'.format(VERSION)) self._configure(**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 new file mode 100644 index 000000000000..4ecbc40f1b53 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_metadata.json @@ -0,0 +1,108 @@ +{ + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-01-preview"], + "client": { + "name": "SignalRManagementClient", + "filename": "_signal_rmanagement_client", + "description": "REST API for Azure SignalR Service.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": 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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "signal_r": "SignalROperations", + "usages": "UsagesOperations", + "signal_rprivate_endpoint_connections": "SignalRPrivateEndpointConnectionsOperations", + "signal_rprivate_link_resources": "SignalRPrivateLinkResourcesOperations", + "signal_rshared_private_link_resources": "SignalRSharedPrivateLinkResourcesOperations" + } +} \ 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 dcdbcafa10c3..cf3fca53100a 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 @@ -16,13 +16,15 @@ 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 UsagesOperations +from .operations import SignalRSharedPrivateLinkResourcesOperations from . import models @@ -33,12 +35,14 @@ class SignalRManagementClient(object): :vartype operations: azure.mgmt.signalr.operations.Operations :ivar signal_r: SignalROperations operations :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_link_resources: SignalRPrivateLinkResourcesOperations operations :vartype signal_rprivate_link_resources: azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations - :ivar usages: UsagesOperations operations - :vartype usages: azure.mgmt.signalr.operations.UsagesOperations + :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. @@ -69,13 +73,33 @@ def __init__( 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.usages = UsagesOperations( + 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 + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + def close(self): # type: () -> None self._client.close() 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 515f51c112dd..035146e99a22 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py @@ -6,5 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" - +VERSION = "0.2.0" 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 4d43674da661..471d5f251764 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-signalr/{}'.format(VERSION)) self._configure(**kwargs) 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 aad5cdeb77f2..88e7b4155c37 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -18,9 +19,10 @@ 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 UsagesOperations +from .operations import SignalRSharedPrivateLinkResourcesOperations from .. import models @@ -31,12 +33,14 @@ class SignalRManagementClient(object): :vartype operations: azure.mgmt.signalr.aio.operations.Operations :ivar signal_r: SignalROperations operations :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_link_resources: SignalRPrivateLinkResourcesOperations operations :vartype signal_rprivate_link_resources: azure.mgmt.signalr.aio.operations.SignalRPrivateLinkResourcesOperations - :ivar usages: UsagesOperations operations - :vartype usages: azure.mgmt.signalr.aio.operations.UsagesOperations + :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. @@ -66,13 +70,32 @@ def __init__( 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.usages = UsagesOperations( + 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: + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + async def close(self) -> None: await self._client.close() diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py index df8e16c5da7b..5cd9fb86e467 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py @@ -8,14 +8,16 @@ from ._operations import Operations from ._signal_r_operations import SignalROperations +from ._usages_operations import UsagesOperations from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations -from ._usages_operations import UsagesOperations +from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations __all__ = [ 'Operations', 'SignalROperations', + 'UsagesOperations', 'SignalRPrivateEndpointConnectionsOperations', 'SignalRPrivateLinkResourcesOperations', - 'UsagesOperations', + 'SignalRSharedPrivateLinkResourcesOperations', ] 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 aa3e56e4953a..87999c3f69f0 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 @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 fad0bba64d44..7df242628e08 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 @@ -46,10 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def check_name_availability( self, location: str, - parameters: Optional["_models.NameAvailabilityParameters"] = None, + parameters: "_models.NameAvailabilityParameters", **kwargs ) -> "_models.NameAvailability": - """Checks that the SignalR name is valid and is not already in use. + """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str @@ -65,7 +65,7 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -87,10 +87,7 @@ async def check_name_availability( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'NameAvailabilityParameters') - else: - body_content = None + 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) @@ -98,7 +95,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailability', pipeline_response) @@ -125,7 +122,7 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -165,7 +162,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -196,7 +193,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -237,7 +234,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -248,34 +245,34 @@ async def get_next(next_link=None): ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR'} # type: ignore - async def list_keys( + async def get( self, resource_group_name: str, resource_name: str, **kwargs - ) -> "_models.SignalRKeys": - """Get the access keys of the SignalR resource. + ) -> "_models.SignalRResource": + """Get the resource and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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: SignalRKeys, or the result of cls(response) - :rtype: ~azure.mgmt.signalr.models.SignalRKeys + :return: SignalRResource, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SignalRResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self.list_keys.metadata['url'] # type: ignore + 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'), @@ -291,41 +288,41 @@ async def list_keys( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.post(url, query_parameters, header_parameters) + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def _regenerate_key_initial( + async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.RegenerateKeyParameters"] = None, + parameters: "_models.SignalRResource", **kwargs - ) -> "_models.SignalRKeys": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + ) -> Optional["_models.SignalRResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._regenerate_key_initial.metadata['url'] # type: ignore + 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'), @@ -343,64 +340,65 @@ async def _regenerate_key_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') - else: - body_content = None + body_content = self._serialize.body(parameters, 'SignalRResource') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + 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 [201]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SignalRResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def begin_regenerate_key( + async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.RegenerateKeyParameters"] = None, + parameters: "_models.SignalRResource", **kwargs - ) -> AsyncLROPoller["_models.SignalRKeys"]: - """Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the - same time. + ) -> AsyncLROPoller["_models.SignalRResource"]: + """Create or update a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameter that describes the Regenerate Key Operation. - :type parameters: ~azure.mgmt.signalr.models.RegenerateKeyParameters + :param parameters: Parameters for the create or update operation. + :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SignalRKeys] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._regenerate_key_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -412,7 +410,7 @@ async def begin_regenerate_key( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -424,7 +422,7 @@ def get_long_running_output(pipeline_response): '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, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,36 +434,24 @@ 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 + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def get( + async def _delete_initial( self, resource_group_name: str, resource_name: str, **kwargs - ) -> "_models.SignalRResource": - """Get the SignalR service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SignalRResource, or the result of cls(response) - :rtype: ~azure.mgmt.signalr.models.SignalRResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self.get.metadata['url'] # type: ignore + 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'), @@ -481,28 +467,90 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) + 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]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def _create_or_update_initial( + async def begin_delete( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.SignalRResource"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Operation to delete a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.SignalRResource", **kwargs ) -> Optional["_models.SignalRResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] @@ -510,12 +558,12 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), @@ -533,53 +581,47 @@ async def _create_or_update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'SignalRResource') - else: - body_content = None + 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) + 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, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SignalRResource', pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize('SignalRResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.SignalRResource"] = None, + parameters: "_models.SignalRResource", **kwargs ) -> AsyncLROPoller["_models.SignalRResource"]: - """Create a new SignalR service and update an exiting SignalR service. + """Operation to update an exiting resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameters for the create or update operation. + :param parameters: Parameters for the update operation. :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -594,7 +636,7 @@ async def begin_create_or_update( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -630,24 +672,36 @@ 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 + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - async def _delete_initial( + async def list_keys( self, resource_group_name: str, resource_name: str, **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] + ) -> "_models.SignalRKeys": + """Get the access keys of the resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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: SignalRKeys, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SignalRKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + 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'), @@ -663,103 +717,41 @@ async def _delete_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + 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]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, 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 - - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Operation to delete a SignalR service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - 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, {}) + deserialized = self._deserialize('SignalRKeys', pipeline_response) - path_format_arguments = { - '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 cls: + return cls(pipeline_response, deserialized, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} # type: ignore - async def _update_initial( + async def _regenerate_key_initial( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.SignalRResource"] = None, + parameters: "_models.RegenerateKeyParameters", **kwargs - ) -> Optional["_models.SignalRResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] + ) -> "_models.SignalRKeys": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._update_initial.metadata['url'] # type: ignore + 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'), @@ -777,65 +769,61 @@ async def _update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'SignalRResource') - else: - body_content = None + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + 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, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SignalRResource', pipeline_response) + deserialized = self._deserialize('SignalRKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore - async def begin_update( + async def begin_regenerate_key( self, resource_group_name: str, resource_name: str, - parameters: Optional["_models.SignalRResource"] = None, + parameters: "_models.RegenerateKeyParameters", **kwargs - ) -> AsyncLROPoller["_models.SignalRResource"]: - """Operation to update an exiting SignalR service. + ) -> AsyncLROPoller["_models.SignalRKeys"]: + """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated + at the same time. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameters for the update operation. - :type parameters: ~azure.mgmt.signalr.models.SignalRResource + :param parameters: Parameter that describes the Regenerate Key Operation. + :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SignalRResource] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._regenerate_key_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -847,7 +835,7 @@ async def begin_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SignalRResource', pipeline_response) + deserialized = self._deserialize('SignalRKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -859,7 +847,7 @@ def get_long_running_output(pipeline_response): '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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -871,7 +859,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + begin_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore async def _restart_initial( self, @@ -884,7 +872,7 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -910,7 +898,7 @@ async def _restart_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -924,17 +912,17 @@ async def begin_restart( resource_name: str, **kwargs ) -> AsyncLROPoller[None]: - """Operation to restart a SignalR service. + """Operation to restart a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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 :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) 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 5b2004847df4..f6d8982fd7b6 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,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +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 @@ -42,6 +43,82 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateEndpointConnectionList"]: + """List private endpoint connections. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + async def get( self, private_endpoint_connection_name: str, @@ -49,15 +126,14 @@ async def get( resource_name: str, **kwargs ) -> "_models.PrivateEndpointConnection": - """Get the specified private endpoint connection associated with a SignalR resource. + """Get the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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: PrivateEndpointConnection, or the result of cls(response) @@ -69,7 +145,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -96,7 +172,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -112,18 +188,17 @@ async def update( private_endpoint_connection_name: str, resource_group_name: str, resource_name: str, - parameters: Optional["_models.PrivateEndpointConnection"] = None, + parameters: "_models.PrivateEndpointConnection", **kwargs ) -> "_models.PrivateEndpointConnection": - """Update the state of specified private endpoint connection associated with a SignalR resource. + """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str :param parameters: The resource of private endpoint and its properties. :type parameters: ~azure.mgmt.signalr.models.PrivateEndpointConnection @@ -137,7 +212,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -161,10 +236,7 @@ async def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - else: - body_content = None + 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) @@ -172,7 +244,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -195,7 +267,7 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -220,9 +292,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -237,20 +309,19 @@ async def begin_delete( resource_name: str, **kwargs ) -> AsyncLROPoller[None]: - """Delete the specified private endpoint connection associated with a SignalR resource. + """Delete the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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 :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) 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 fdcdc5b45948..06b7c33e47fe 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 @@ -47,12 +47,12 @@ def list( resource_name: str, **kwargs ) -> AsyncIterable["_models.PrivateLinkResourceList"]: - """Get the private link resources that need to be created for a SignalR resource. + """Get the private link resources that need to be created for a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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) @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -106,7 +106,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 new file mode 100644 index 000000000000..cf13d9739189 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py @@ -0,0 +1,438 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SignalRSharedPrivateLinkResourcesOperations: + """SignalRSharedPrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.signalr.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedPrivateLinkResourceList"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + async def get( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.SharedPrivateLinkResource": + """Get the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + 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, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs + ) -> "_models.SharedPrivateLinkResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs + ) -> AsyncLROPoller["_models.SharedPrivateLinkResource"]: + """Create or update a shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The shared private link resource. + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def begin_delete( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 6f590c1ee712..56e6881033fa 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 @@ -46,7 +46,7 @@ def list( location: str, **kwargs ) -> AsyncIterable["_models.SignalRUsageList"]: - """List usage quotas for Azure SignalR service by location. + """List resource usage quotas by location. :param location: the location like "eastus". :type location: str @@ -60,7 +60,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -101,7 +101,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py index 0e9db489b5dc..163dca8ae020 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py @@ -8,8 +8,9 @@ try: from ._models_py3 import Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody from ._models_py3 import LogSpecification from ._models_py3 import ManagedIdentity from ._models_py3 import ManagedIdentitySettings @@ -24,6 +25,7 @@ from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointACL from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionList from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceList from ._models_py3 import PrivateLinkServiceConnectionState @@ -33,26 +35,30 @@ from ._models_py3 import ResourceSku from ._models_py3 import ServerlessUpstreamSettings from ._models_py3 import ServiceSpecification + from ._models_py3 import ShareablePrivateLinkResourceProperties + from ._models_py3 import ShareablePrivateLinkResourceType + from ._models_py3 import SharedPrivateLinkResource + from ._models_py3 import SharedPrivateLinkResourceList from ._models_py3 import SignalRCorsSettings - from ._models_py3 import SignalRCreateOrUpdateProperties from ._models_py3 import SignalRFeature from ._models_py3 import SignalRKeys from ._models_py3 import SignalRNetworkACLs - from ._models_py3 import SignalRProperties from ._models_py3 import SignalRResource from ._models_py3 import SignalRResourceList from ._models_py3 import SignalRTlsSettings from ._models_py3 import SignalRUsage from ._models_py3 import SignalRUsageList from ._models_py3 import SignalRUsageName + from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import UpstreamAuthSettings from ._models_py3 import UpstreamTemplate from ._models_py3 import UserAssignedIdentityProperty except (SyntaxError, ImportError): from ._models import Dimension # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore from ._models import LogSpecification # type: ignore from ._models import ManagedIdentity # type: ignore from ._models import ManagedIdentitySettings # type: ignore @@ -67,6 +73,7 @@ from ._models import PrivateEndpoint # type: ignore from ._models import PrivateEndpointACL # type: ignore from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionList # type: ignore from ._models import PrivateLinkResource # type: ignore from ._models import PrivateLinkResourceList # type: ignore from ._models import PrivateLinkServiceConnectionState # type: ignore @@ -76,18 +83,21 @@ from ._models import ResourceSku # type: ignore from ._models import ServerlessUpstreamSettings # type: ignore from ._models import ServiceSpecification # type: ignore + from ._models import ShareablePrivateLinkResourceProperties # type: ignore + from ._models import ShareablePrivateLinkResourceType # type: ignore + from ._models import SharedPrivateLinkResource # type: ignore + from ._models import SharedPrivateLinkResourceList # type: ignore from ._models import SignalRCorsSettings # type: ignore - from ._models import SignalRCreateOrUpdateProperties # type: ignore from ._models import SignalRFeature # type: ignore from ._models import SignalRKeys # type: ignore from ._models import SignalRNetworkACLs # type: ignore - from ._models import SignalRProperties # type: ignore from ._models import SignalRResource # type: ignore from ._models import SignalRResourceList # type: ignore from ._models import SignalRTlsSettings # type: ignore from ._models import SignalRUsage # type: ignore from ._models import SignalRUsageList # type: ignore from ._models import SignalRUsageName # type: ignore + from ._models import SystemData # type: ignore from ._models import TrackedResource # type: ignore from ._models import UpstreamAuthSettings # type: ignore from ._models import UpstreamTemplate # type: ignore @@ -95,12 +105,14 @@ from ._signal_rmanagement_client_enums import ( ACLAction, + CreatedByType, FeatureFlags, KeyType, ManagedIdentityType, PrivateLinkServiceConnectionStatus, ProvisioningState, ServiceKind, + SharedPrivateLinkResourceStatus, SignalRRequestType, SignalRSkuTier, UpstreamAuthType, @@ -108,8 +120,9 @@ __all__ = [ 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorDetail', 'ErrorResponse', - 'ErrorResponseBody', 'LogSpecification', 'ManagedIdentity', 'ManagedIdentitySettings', @@ -124,6 +137,7 @@ 'PrivateEndpoint', 'PrivateEndpointACL', 'PrivateEndpointConnection', + 'PrivateEndpointConnectionList', 'PrivateLinkResource', 'PrivateLinkResourceList', 'PrivateLinkServiceConnectionState', @@ -133,29 +147,34 @@ 'ResourceSku', 'ServerlessUpstreamSettings', 'ServiceSpecification', + 'ShareablePrivateLinkResourceProperties', + 'ShareablePrivateLinkResourceType', + 'SharedPrivateLinkResource', + 'SharedPrivateLinkResourceList', 'SignalRCorsSettings', - 'SignalRCreateOrUpdateProperties', 'SignalRFeature', 'SignalRKeys', 'SignalRNetworkACLs', - 'SignalRProperties', 'SignalRResource', 'SignalRResourceList', 'SignalRTlsSettings', 'SignalRUsage', 'SignalRUsageList', 'SignalRUsageName', + 'SystemData', 'TrackedResource', 'UpstreamAuthSettings', 'UpstreamTemplate', 'UserAssignedIdentityProperty', 'ACLAction', + 'CreatedByType', 'FeatureFlags', 'KeyType', 'ManagedIdentityType', 'PrivateLinkServiceConnectionStatus', 'ProvisioningState', 'ServiceKind', + 'SharedPrivateLinkResourceStatus', 'SignalRRequestType', 'SignalRSkuTier', 'UpstreamAuthType', 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 fba6962deb1d..8d954049737f 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 @@ -42,65 +42,98 @@ def __init__( self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class ErrorResponse(msrest.serialization.Model): - """Contains information about an API error. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: Describes a particular API error with an error code and a message. - :type error: ~azure.mgmt.signalr.models.ErrorResponseBody + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponseBody(msrest.serialization.Model): - """Describes a particular API error with an error code and a message. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. An error code that describes the error condition more precisely than an - HTTP status code. - Can be used to programmatically handle specific error cases. - :type code: str - :param message: Required. A message that describes the error in detail and provides debugging - information. - :type message: str - :param target: The target of the particular error (for example, the name of the property in - error). - :type target: str - :param details: Contains nested errors that are related to this error. - :type details: list[~azure.mgmt.signalr.models.ErrorResponseBody] + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.signalr.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.signalr.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.signalr.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class LogSpecification(msrest.serialization.Model): @@ -274,9 +307,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The resource type. Should be always "Microsoft.SignalRService/SignalR". + :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + "Microsoft.SignalRService/webPubSub". :type type: str - :param name: Required. The SignalR service name to validate. e.g."my-signalR-name-here". + :param name: Required. The resource name to validate. e.g."my-resource-name". :type name: str """ @@ -325,7 +359,7 @@ def __init__( class Operation(msrest.serialization.Model): - """REST API operation supported by SignalR resource provider. + """REST API operation supported by resource provider. :param name: Name of the operation with format: {provider}/{resource}/{operation}. :type name: str @@ -522,8 +556,40 @@ def __init__( self.type = None -class PrivateEndpointConnection(Resource): - """A private endpoint connection to SignalR resource. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection to an azure resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -533,6 +599,8 @@ class PrivateEndpointConnection(Resource): :vartype name: str :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -548,6 +616,7 @@ class PrivateEndpointConnection(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -555,6 +624,7 @@ class PrivateEndpointConnection(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, @@ -565,12 +635,38 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None self.provisioning_state = None self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) -class PrivateLinkResource(Resource): +class PrivateEndpointConnectionList(msrest.serialization.Model): + """A list of private endpoint connections. + + :param value: The list of the private endpoint connections. + :type value: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(ProxyResource): """Private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -587,6 +683,10 @@ class PrivateLinkResource(Resource): :type required_members: list[str] :param required_zone_names: Required private DNS zone names. :type required_zone_names: list[str] + :param shareable_private_link_resource_types: The list of resources that are onboarded to + private link service. + :type shareable_private_link_resource_types: + list[~azure.mgmt.signalr.models.ShareablePrivateLinkResourceType] """ _validation = { @@ -602,6 +702,7 @@ class PrivateLinkResource(Resource): 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'properties.shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, } def __init__( @@ -612,10 +713,11 @@ def __init__( self.group_id = kwargs.get('group_id', None) self.required_members = kwargs.get('required_members', None) self.required_zone_names = kwargs.get('required_zone_names', None) + self.shareable_private_link_resource_types = kwargs.get('shareable_private_link_resource_types', None) class PrivateLinkResourceList(msrest.serialization.Model): - """Contains a list of AzSignalR.Models.Response.PrivateLink.PrivateLinkResource and a possible link to query more results. + """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] @@ -668,43 +770,11 @@ def __init__( self.actions_required = kwargs.get('actions_required', None) -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - class RegenerateKeyParameters(msrest.serialization.Model): """Parameters describes the request to regenerate access keys. - :param key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case- - insensitive). Possible values include: "Primary", "Secondary". + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary". :type key_type: str or ~azure.mgmt.signalr.models.KeyType """ @@ -721,7 +791,9 @@ def __init__( class ResourceSku(msrest.serialization.Model): - """The billing information of the SignalR resource. + """The billing information of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -734,11 +806,11 @@ class ResourceSku(msrest.serialization.Model): ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", "Standard", "Premium". :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier - :param size: Optional string. For future use. - :type size: str - :param family: Optional string. For future use. - :type family: str - :param capacity: Optional, integer. The unit count of SignalR resource. 1 by default. + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str + :param capacity: Optional, integer. The unit count of the resource. 1 by default. If present, following values are allowed: Free: 1 @@ -748,6 +820,8 @@ class ResourceSku(msrest.serialization.Model): _validation = { 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, } _attribute_map = { @@ -765,13 +839,13 @@ def __init__( super(ResourceSku, self).__init__(**kwargs) self.name = kwargs['name'] self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) + self.size = None + self.family = None self.capacity = kwargs.get('capacity', None) class ServerlessUpstreamSettings(msrest.serialization.Model): - """The settings for the Upstream when the Azure SignalR is in server-less mode. + """The settings for the Upstream when the service is in server-less mode. :param templates: Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. @@ -813,63 +887,169 @@ def __init__( self.log_specifications = kwargs.get('log_specifications', None) -class SignalRCorsSettings(msrest.serialization.Model): - """Cross-Origin Resource Sharing (CORS) settings. +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service. - :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- - origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow - all by default. - :type allowed_origins: list[str] + :param description: The description of the resource type that has been onboarded to private + link service. + :type description: str + :param group_id: The resource provider group id for the resource that has been onboarded to + private link service. + :type group_id: str + :param type: The resource provider type for the resource that has been onboarded to private + link service. + :type type: str """ _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(SignalRCorsSettings, self).__init__(**kwargs) - self.allowed_origins = kwargs.get('allowed_origins', None) + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.group_id = kwargs.get('group_id', None) + self.type = kwargs.get('type', None) -class SignalRCreateOrUpdateProperties(msrest.serialization.Model): - """Settings used to provision or configure the resource. +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes a resource type that has been onboarded to private link service. - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 name: The name of the resource type that has been onboarded to private link service. + :type name: str + :param properties: Describes the properties of a resource type that has been onboarded to + private link service. + :type properties: ~azure.mgmt.signalr.models.ShareablePrivateLinkResourceProperties """ _attribute_map = { - 'features': {'key': 'features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'networkACLs', 'type': 'SignalRNetworkACLs'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, } def __init__( self, **kwargs ): - super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) - self.features = kwargs.get('features', None) - self.cors = kwargs.get('cors', None) - self.upstream = kwargs.get('upstream', None) - self.network_ac_ls = kwargs.get('network_ac_ls', None) + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class SharedPrivateLinkResource(ProxyResource): + """Describes a Shared Private Link Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :ivar provisioning_state: Provisioning state of the shared private link resource. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :ivar status: Status of the shared private link resource. Possible values include: "Pending", + "Approved", "Rejected", "Disconnected", "Timeout". + :vartype status: str or ~azure.mgmt.signalr.models.SharedPrivateLinkResourceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.system_data = None + self.group_id = kwargs.get('group_id', None) + self.private_link_resource_id = kwargs.get('private_link_resource_id', None) + self.provisioning_state = None + self.request_message = kwargs.get('request_message', None) + self.status = None + + +class SharedPrivateLinkResourceList(msrest.serialization.Model): + """A list of shared private link resources. + + :param value: The list of the shared private link resources. + :type value: list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SignalRCorsSettings(msrest.serialization.Model): + """Cross-Origin Resource Sharing (CORS) settings. + + :param allowed_origins: Gets or sets the list of origins that should be allowed to make + cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, + allow all by default. + :type allowed_origins: list[str] + """ + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SignalRCorsSettings, self).__init__(**kwargs) + self.allowed_origins = kwargs.get('allowed_origins', None) class SignalRFeature(msrest.serialization.Model): @@ -885,8 +1065,15 @@ class SignalRFeature(msrest.serialization.Model): "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. Possible values include: "ServiceMode", "EnableConnectivityLogs", - "EnableMessagingLogs". + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR + service, it will give you live traces in real time, it will be helpful when you developing your + own Azure SignalR based web application or self-troubleshooting some issues. Please note that + live traces are counted as outbound messages that will be charged. Values allowed: + "true"/"false", to enable/disable live trace feature. Possible values include: "ServiceMode", + "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". :type flag: str or ~azure.mgmt.signalr.models.FeatureFlags :param value: Required. Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. @@ -917,15 +1104,15 @@ def __init__( class SignalRKeys(msrest.serialization.Model): - """A class represents the access keys of SignalR service. + """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: SignalR connection string constructed via the primaryKey. + :param primary_connection_string: Connection string constructed via the primaryKey. :type primary_connection_string: str - :param secondary_connection_string: SignalR connection string constructed via the secondaryKey. + :param secondary_connection_string: Connection string constructed via the secondaryKey. :type secondary_connection_string: str """ @@ -948,7 +1135,7 @@ def __init__( class SignalRNetworkACLs(msrest.serialization.Model): - """Network ACLs for SignalR. + """Network ACLs for the resource. :param default_action: Default action when no other rule matches. Possible values include: "Allow", "Deny". @@ -975,90 +1162,6 @@ def __init__( self.private_endpoints = kwargs.get('private_endpoints', None) -class SignalRProperties(SignalRCreateOrUpdateProperties): - """A class that describes the properties of the SignalR service that should contain more read-only properties than AzSignalR.Models.SignalRCreateOrUpdateProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", - "Moving". - :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState - :ivar external_ip: The publicly accessible IP of the SignalR service. - :vartype external_ip: str - :ivar host_name: FQDN of the SignalR service instance. Format: xxx.service.signalr.net. - :vartype host_name: str - :ivar public_port: The publicly accessible port of the SignalR service which is designed for - browser/client side usage. - :vartype public_port: int - :ivar server_port: The publicly accessible port of the SignalR service which is designed for - customer server side usage. - :vartype server_port: int - :ivar version: Version of the SignalR resource. Probably you need the same or higher version of - client SDKs. - :vartype version: str - :ivar private_endpoint_connections: Private endpoint connections to the SignalR resource. - :vartype private_endpoint_connections: - list[~azure.mgmt.signalr.models.PrivateEndpointConnection] - :param tls: TLS settings. - :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'external_ip': {'readonly': True}, - 'host_name': {'readonly': True}, - 'public_port': {'readonly': True}, - 'server_port': {'readonly': True}, - 'version': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'networkACLs', 'type': 'SignalRNetworkACLs'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'external_ip': {'key': 'externalIP', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'server_port': {'key': 'serverPort', 'type': 'int'}, - 'version': {'key': 'version', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'tls': {'key': 'tls', 'type': 'SignalRTlsSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SignalRProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.external_ip = None - self.host_name = None - self.public_port = None - self.server_port = None - self.version = None - self.private_endpoint_connections = None - self.tls = kwargs.get('tls', None) - - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. @@ -1070,8 +1173,8 @@ 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 SignalR service. e.g. West US | East US | North - Central US | South Central US. + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. :type location: str :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. @@ -1102,7 +1205,7 @@ def __init__( class SignalRResource(TrackedResource): - """A class represent a SignalR service resource. + """A class represent a resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1112,62 +1215,68 @@ 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 SignalR service. e.g. West US | East US | North - Central US | South Central US. + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. :type location: str :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] :param sku: The billing information of the resource.(e.g. Free, Standard). :type sku: ~azure.mgmt.signalr.models.ResourceSku - :param kind: The kind of the service - e.g. "SignalR", or "RawWebSockets" for - "Microsoft.SignalRService/SignalR". Possible values include: "SignalR", "RawWebSockets". + :param kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". + Possible values include: "SignalR", "RawWebSockets". :type kind: str or ~azure.mgmt.signalr.models.ServiceKind :param identity: The managed identity response. :type identity: ~azure.mgmt.signalr.models.ManagedIdentity - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState - :ivar external_ip: The publicly accessible IP of the SignalR service. + :ivar external_ip: The publicly accessible IP of the resource. :vartype external_ip: str - :ivar host_name: FQDN of the SignalR service instance. Format: xxx.service.signalr.net. + :ivar host_name: FQDN of the service instance. :vartype host_name: str - :ivar public_port: The publicly accessible port of the SignalR service which is designed for + :ivar public_port: The publicly accessible port of the resource which is designed for browser/client side usage. :vartype public_port: int - :ivar server_port: The publicly accessible port of the SignalR service which is designed for - customer server side usage. + :ivar server_port: The publicly accessible port of the resource which is designed for customer + server side usage. :vartype server_port: int - :ivar version: Version of the SignalR resource. Probably you need the same or higher version of - client SDKs. + :ivar version: Version of the resource. Probably you need the same or higher version of client + SDKs. :vartype version: str - :ivar private_endpoint_connections: Private endpoint connections to the SignalR resource. + :ivar private_endpoint_connections: Private endpoint connections to the resource. :vartype private_endpoint_connections: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources. + :vartype shared_private_link_resources: + list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] :param tls: TLS settings. :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings + :param features: List of the featureFlags. + + FeatureFlags that are not included in the parameters for the update operation will not be + modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, its globally default value will be used + But keep in mind, the default value doesn't mean "false". It varies in terms of different + FeatureFlags. + :type features: list[~azure.mgmt.signalr.models.SignalRFeature] + :param 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 """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'external_ip': {'readonly': True}, 'host_name': {'readonly': True}, @@ -1175,6 +1284,7 @@ class SignalRResource(TrackedResource): 'server_port': {'readonly': True}, 'version': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, } _attribute_map = { @@ -1186,10 +1296,7 @@ class SignalRResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'ResourceSku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'SignalRNetworkACLs'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, @@ -1197,7 +1304,12 @@ class SignalRResource(TrackedResource): 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, 'version': {'key': 'properties.version', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, 'tls': {'key': 'properties.tls', 'type': 'SignalRTlsSettings'}, + 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, + 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, + 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, + 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'SignalRNetworkACLs'}, } def __init__( @@ -1208,10 +1320,7 @@ def __init__( self.sku = kwargs.get('sku', None) self.kind = kwargs.get('kind', None) self.identity = kwargs.get('identity', None) - self.features = kwargs.get('features', None) - self.cors = kwargs.get('cors', None) - self.upstream = kwargs.get('upstream', None) - self.network_ac_ls = kwargs.get('network_ac_ls', None) + self.system_data = None self.provisioning_state = None self.external_ip = None self.host_name = None @@ -1219,13 +1328,18 @@ def __init__( self.server_port = None self.version = None self.private_endpoint_connections = None + self.shared_private_link_resources = None self.tls = kwargs.get('tls', None) + self.features = kwargs.get('features', None) + self.cors = kwargs.get('cors', None) + self.upstream = kwargs.get('upstream', None) + self.network_ac_ls = kwargs.get('network_ac_ls', None) class SignalRResourceList(msrest.serialization.Model): - """Object that includes an array of SignalR services and a possible link for next set. + """Object that includes an array of resources and a possible link for next set. - :param value: List of SignalR services. + :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). @@ -1248,7 +1362,7 @@ def __init__( class SignalRTlsSettings(msrest.serialization.Model): - """TLS settings for SignalR. + """TLS settings for the resource. :param client_cert_enabled: Request client certificate during TLS handshake if enabled. :type client_cert_enabled: bool @@ -1267,7 +1381,7 @@ def __init__( class SignalRUsage(msrest.serialization.Model): - """Object that describes a specific usage of SignalR resources. + """Object that describes a specific usage of the resources. :param id: Fully qualified ARM resource id. :type id: str @@ -1304,9 +1418,9 @@ def __init__( class SignalRUsageList(msrest.serialization.Model): - """Object that includes an array of SignalR resource usages and a possible link for next set. + """Object that includes an array of the resource usages and a possible link for next set. - :param value: List of SignalR usages. + :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). @@ -1351,6 +1465,47 @@ def __init__( self.localized_value = kwargs.get('localized_value', None) +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.signalr.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.signalr.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + class UpstreamAuthSettings(msrest.serialization.Model): """Upstream auth settings. 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 15f5cdafc296..bdb9e4154544 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 @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -51,72 +52,100 @@ def __init__( self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class ErrorResponse(msrest.serialization.Model): - """Contains information about an API error. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: Describes a particular API error with an error code and a message. - :type error: ~azure.mgmt.signalr.models.ErrorResponseBody + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - error: Optional["ErrorResponseBody"] = None, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponseBody(msrest.serialization.Model): - """Describes a particular API error with an error code and a message. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. An error code that describes the error condition more precisely than an - HTTP status code. - Can be used to programmatically handle specific error cases. - :type code: str - :param message: Required. A message that describes the error in detail and provides debugging - information. - :type message: str - :param target: The target of the particular error (for example, the name of the property in - error). - :type target: str - :param details: Contains nested errors that are related to this error. - :type details: list[~azure.mgmt.signalr.models.ErrorResponseBody] + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.signalr.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.signalr.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.signalr.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: str, - message: str, - target: Optional[str] = None, - details: Optional[List["ErrorResponseBody"]] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class LogSpecification(msrest.serialization.Model): @@ -311,9 +340,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The resource type. Should be always "Microsoft.SignalRService/SignalR". + :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + "Microsoft.SignalRService/webPubSub". :type type: str - :param name: Required. The SignalR service name to validate. e.g."my-signalR-name-here". + :param name: Required. The resource name to validate. e.g."my-resource-name". :type name: str """ @@ -368,7 +398,7 @@ def __init__( class Operation(msrest.serialization.Model): - """REST API operation supported by SignalR resource provider. + """REST API operation supported by resource provider. :param name: Name of the operation with format: {provider}/{resource}/{operation}. :type name: str @@ -587,8 +617,8 @@ def __init__( self.type = None -class PrivateEndpointConnection(Resource): - """A private endpoint connection to SignalR resource. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. Variables are only populated by the server, and will be ignored when sending a request. @@ -598,6 +628,40 @@ class PrivateEndpointConnection(Resource): :vartype name: str :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection to an azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -613,6 +677,7 @@ class PrivateEndpointConnection(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -620,6 +685,7 @@ class PrivateEndpointConnection(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, @@ -633,12 +699,41 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None self.provisioning_state = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state -class PrivateLinkResource(Resource): +class PrivateEndpointConnectionList(msrest.serialization.Model): + """A list of private endpoint connections. + + :param value: The list of the private endpoint connections. + :type value: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(ProxyResource): """Private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -655,6 +750,10 @@ class PrivateLinkResource(Resource): :type required_members: list[str] :param required_zone_names: Required private DNS zone names. :type required_zone_names: list[str] + :param shareable_private_link_resource_types: The list of resources that are onboarded to + private link service. + :type shareable_private_link_resource_types: + list[~azure.mgmt.signalr.models.ShareablePrivateLinkResourceType] """ _validation = { @@ -670,6 +769,7 @@ class PrivateLinkResource(Resource): 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'properties.shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, } def __init__( @@ -678,16 +778,18 @@ def __init__( group_id: Optional[str] = None, required_members: Optional[List[str]] = None, required_zone_names: Optional[List[str]] = None, + shareable_private_link_resource_types: Optional[List["ShareablePrivateLinkResourceType"]] = None, **kwargs ): super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = group_id self.required_members = required_members self.required_zone_names = required_zone_names + self.shareable_private_link_resource_types = shareable_private_link_resource_types class PrivateLinkResourceList(msrest.serialization.Model): - """Contains a list of AzSignalR.Models.Response.PrivateLink.PrivateLinkResource and a possible link to query more results. + """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] @@ -747,43 +849,11 @@ def __init__( self.actions_required = actions_required -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - class RegenerateKeyParameters(msrest.serialization.Model): """Parameters describes the request to regenerate access keys. - :param key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case- - insensitive). Possible values include: "Primary", "Secondary". + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary". :type key_type: str or ~azure.mgmt.signalr.models.KeyType """ @@ -802,7 +872,9 @@ def __init__( class ResourceSku(msrest.serialization.Model): - """The billing information of the SignalR resource. + """The billing information of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -815,11 +887,11 @@ class ResourceSku(msrest.serialization.Model): ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", "Standard", "Premium". :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier - :param size: Optional string. For future use. - :type size: str - :param family: Optional string. For future use. - :type family: str - :param capacity: Optional, integer. The unit count of SignalR resource. 1 by default. + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str + :param capacity: Optional, integer. The unit count of the resource. 1 by default. If present, following values are allowed: Free: 1 @@ -829,6 +901,8 @@ class ResourceSku(msrest.serialization.Model): _validation = { 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, } _attribute_map = { @@ -844,21 +918,19 @@ def __init__( *, name: str, tier: Optional[Union[str, "SignalRSkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, capacity: Optional[int] = None, **kwargs ): super(ResourceSku, self).__init__(**kwargs) self.name = name self.tier = tier - self.size = size - self.family = family + self.size = None + self.family = None self.capacity = capacity class ServerlessUpstreamSettings(msrest.serialization.Model): - """The settings for the Upstream when the Azure SignalR is in server-less mode. + """The settings for the Upstream when the service is in server-less mode. :param templates: Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. @@ -905,70 +977,185 @@ def __init__( self.log_specifications = log_specifications -class SignalRCorsSettings(msrest.serialization.Model): - """Cross-Origin Resource Sharing (CORS) settings. +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service. - :param allowed_origins: Gets or sets the list of origins that should be allowed to make cross- - origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow - all by default. - :type allowed_origins: list[str] + :param description: The description of the resource type that has been onboarded to private + link service. + :type description: str + :param group_id: The resource provider group id for the resource that has been onboarded to + private link service. + :type group_id: str + :param type: The resource provider type for the resource that has been onboarded to private + link service. + :type type: str """ _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - allowed_origins: Optional[List[str]] = None, + description: Optional[str] = None, + group_id: Optional[str] = None, + type: Optional[str] = None, **kwargs ): - super(SignalRCorsSettings, self).__init__(**kwargs) - self.allowed_origins = allowed_origins + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.description = description + self.group_id = group_id + self.type = type -class SignalRCreateOrUpdateProperties(msrest.serialization.Model): - """Settings used to provision or configure the resource. +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes a resource type that has been onboarded to private link service. - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 name: The name of the resource type that has been onboarded to private link service. + :type name: str + :param properties: Describes the properties of a resource type that has been onboarded to + private link service. + :type properties: ~azure.mgmt.signalr.models.ShareablePrivateLinkResourceProperties """ _attribute_map = { - 'features': {'key': 'features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'networkACLs', 'type': 'SignalRNetworkACLs'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, } def __init__( self, *, - features: Optional[List["SignalRFeature"]] = None, - cors: Optional["SignalRCorsSettings"] = None, - upstream: Optional["ServerlessUpstreamSettings"] = None, - network_ac_ls: Optional["SignalRNetworkACLs"] = None, + name: Optional[str] = None, + properties: Optional["ShareablePrivateLinkResourceProperties"] = None, **kwargs ): - super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) - self.features = features - self.cors = cors - self.upstream = upstream - self.network_ac_ls = network_ac_ls + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class SharedPrivateLinkResource(ProxyResource): + """Describes a Shared Private Link Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :ivar provisioning_state: Provisioning state of the shared private link resource. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :ivar status: Status of the shared private link resource. Possible values include: "Pending", + "Approved", "Rejected", "Disconnected", "Timeout". + :vartype status: str or ~azure.mgmt.signalr.models.SharedPrivateLinkResourceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + private_link_resource_id: Optional[str] = None, + request_message: Optional[str] = None, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.system_data = None + self.group_id = group_id + self.private_link_resource_id = private_link_resource_id + self.provisioning_state = None + self.request_message = request_message + self.status = None + + +class SharedPrivateLinkResourceList(msrest.serialization.Model): + """A list of shared private link resources. + + :param value: The list of the shared private link resources. + :type value: list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedPrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SharedPrivateLinkResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SignalRCorsSettings(msrest.serialization.Model): + """Cross-Origin Resource Sharing (CORS) settings. + + :param allowed_origins: Gets or sets the list of origins that should be allowed to make + cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, + allow all by default. + :type allowed_origins: list[str] + """ + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + **kwargs + ): + super(SignalRCorsSettings, self).__init__(**kwargs) + self.allowed_origins = allowed_origins class SignalRFeature(msrest.serialization.Model): @@ -984,8 +1171,15 @@ class SignalRFeature(msrest.serialization.Model): "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. Possible values include: "ServiceMode", "EnableConnectivityLogs", - "EnableMessagingLogs". + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR + service, it will give you live traces in real time, it will be helpful when you developing your + own Azure SignalR based web application or self-troubleshooting some issues. Please note that + live traces are counted as outbound messages that will be charged. Values allowed: + "true"/"false", to enable/disable live trace feature. Possible values include: "ServiceMode", + "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". :type flag: str or ~azure.mgmt.signalr.models.FeatureFlags :param value: Required. Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. @@ -1020,15 +1214,15 @@ def __init__( class SignalRKeys(msrest.serialization.Model): - """A class represents the access keys of SignalR service. + """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: SignalR connection string constructed via the primaryKey. + :param primary_connection_string: Connection string constructed via the primaryKey. :type primary_connection_string: str - :param secondary_connection_string: SignalR connection string constructed via the secondaryKey. + :param secondary_connection_string: Connection string constructed via the secondaryKey. :type secondary_connection_string: str """ @@ -1056,7 +1250,7 @@ def __init__( class SignalRNetworkACLs(msrest.serialization.Model): - """Network ACLs for SignalR. + """Network ACLs for the resource. :param default_action: Default action when no other rule matches. Possible values include: "Allow", "Deny". @@ -1087,96 +1281,6 @@ def __init__( self.private_endpoints = private_endpoints -class SignalRProperties(SignalRCreateOrUpdateProperties): - """A class that describes the properties of the SignalR service that should contain more read-only properties than AzSignalR.Models.SignalRCreateOrUpdateProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 - :ivar provisioning_state: Provisioning state of the resource. Possible values include: - "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", - "Moving". - :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState - :ivar external_ip: The publicly accessible IP of the SignalR service. - :vartype external_ip: str - :ivar host_name: FQDN of the SignalR service instance. Format: xxx.service.signalr.net. - :vartype host_name: str - :ivar public_port: The publicly accessible port of the SignalR service which is designed for - browser/client side usage. - :vartype public_port: int - :ivar server_port: The publicly accessible port of the SignalR service which is designed for - customer server side usage. - :vartype server_port: int - :ivar version: Version of the SignalR resource. Probably you need the same or higher version of - client SDKs. - :vartype version: str - :ivar private_endpoint_connections: Private endpoint connections to the SignalR resource. - :vartype private_endpoint_connections: - list[~azure.mgmt.signalr.models.PrivateEndpointConnection] - :param tls: TLS settings. - :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'external_ip': {'readonly': True}, - 'host_name': {'readonly': True}, - 'public_port': {'readonly': True}, - 'server_port': {'readonly': True}, - 'version': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'networkACLs', 'type': 'SignalRNetworkACLs'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'external_ip': {'key': 'externalIP', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'server_port': {'key': 'serverPort', 'type': 'int'}, - 'version': {'key': 'version', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'tls': {'key': 'tls', 'type': 'SignalRTlsSettings'}, - } - - def __init__( - self, - *, - features: Optional[List["SignalRFeature"]] = None, - cors: Optional["SignalRCorsSettings"] = None, - upstream: Optional["ServerlessUpstreamSettings"] = None, - network_ac_ls: Optional["SignalRNetworkACLs"] = None, - tls: Optional["SignalRTlsSettings"] = None, - **kwargs - ): - super(SignalRProperties, self).__init__(features=features, cors=cors, upstream=upstream, network_ac_ls=network_ac_ls, **kwargs) - self.provisioning_state = None - self.external_ip = None - self.host_name = None - self.public_port = None - self.server_port = None - self.version = None - self.private_endpoint_connections = None - self.tls = tls - - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. @@ -1188,8 +1292,8 @@ 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 SignalR service. e.g. West US | East US | North - Central US | South Central US. + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. :type location: str :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. @@ -1223,7 +1327,7 @@ def __init__( class SignalRResource(TrackedResource): - """A class represent a SignalR service resource. + """A class represent a resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1233,62 +1337,68 @@ 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 SignalR service. e.g. West US | East US | North - Central US | South Central US. + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. :type location: str :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] :param sku: The billing information of the resource.(e.g. Free, Standard). :type sku: ~azure.mgmt.signalr.models.ResourceSku - :param kind: The kind of the service - e.g. "SignalR", or "RawWebSockets" for - "Microsoft.SignalRService/SignalR". Possible values include: "SignalR", "RawWebSockets". + :param kind: The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". + Possible values include: "SignalR", "RawWebSockets". :type kind: str or ~azure.mgmt.signalr.models.ServiceKind :param identity: The managed identity response. :type identity: ~azure.mgmt.signalr.models.ManagedIdentity - :param features: List of SignalR featureFlags. e.g. ServiceMode. - - 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, SignalR service will use its globally default value. - 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 cors: Cross-Origin Resource Sharing (CORS) settings. - :type cors: ~azure.mgmt.signalr.models.SignalRCorsSettings - :param upstream: Upstream settings when the Azure SignalR 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 + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState - :ivar external_ip: The publicly accessible IP of the SignalR service. + :ivar external_ip: The publicly accessible IP of the resource. :vartype external_ip: str - :ivar host_name: FQDN of the SignalR service instance. Format: xxx.service.signalr.net. + :ivar host_name: FQDN of the service instance. :vartype host_name: str - :ivar public_port: The publicly accessible port of the SignalR service which is designed for + :ivar public_port: The publicly accessible port of the resource which is designed for browser/client side usage. :vartype public_port: int - :ivar server_port: The publicly accessible port of the SignalR service which is designed for - customer server side usage. + :ivar server_port: The publicly accessible port of the resource which is designed for customer + server side usage. :vartype server_port: int - :ivar version: Version of the SignalR resource. Probably you need the same or higher version of - client SDKs. + :ivar version: Version of the resource. Probably you need the same or higher version of client + SDKs. :vartype version: str - :ivar private_endpoint_connections: Private endpoint connections to the SignalR resource. + :ivar private_endpoint_connections: Private endpoint connections to the resource. :vartype private_endpoint_connections: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources. + :vartype shared_private_link_resources: + list[~azure.mgmt.signalr.models.SharedPrivateLinkResource] :param tls: TLS settings. :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings + :param features: List of the featureFlags. + + FeatureFlags that are not included in the parameters for the update operation will not be + modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, its globally default value will be used + But keep in mind, the default value doesn't mean "false". It varies in terms of different + FeatureFlags. + :type features: list[~azure.mgmt.signalr.models.SignalRFeature] + :param 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 """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'external_ip': {'readonly': True}, 'host_name': {'readonly': True}, @@ -1296,6 +1406,7 @@ class SignalRResource(TrackedResource): 'server_port': {'readonly': True}, 'version': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, } _attribute_map = { @@ -1307,10 +1418,7 @@ class SignalRResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'ResourceSku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, - 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, - 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, - 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'SignalRNetworkACLs'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, @@ -1318,7 +1426,12 @@ class SignalRResource(TrackedResource): 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, 'version': {'key': 'properties.version', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, 'tls': {'key': 'properties.tls', 'type': 'SignalRTlsSettings'}, + 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, + 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, + 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, + 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'SignalRNetworkACLs'}, } def __init__( @@ -1329,21 +1442,18 @@ def __init__( sku: Optional["ResourceSku"] = None, kind: Optional[Union[str, "ServiceKind"]] = None, identity: Optional["ManagedIdentity"] = None, + tls: Optional["SignalRTlsSettings"] = None, features: Optional[List["SignalRFeature"]] = None, cors: Optional["SignalRCorsSettings"] = None, upstream: Optional["ServerlessUpstreamSettings"] = None, network_ac_ls: Optional["SignalRNetworkACLs"] = None, - tls: Optional["SignalRTlsSettings"] = None, **kwargs ): super(SignalRResource, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.kind = kind self.identity = identity - self.features = features - self.cors = cors - self.upstream = upstream - self.network_ac_ls = network_ac_ls + self.system_data = None self.provisioning_state = None self.external_ip = None self.host_name = None @@ -1351,13 +1461,18 @@ def __init__( self.server_port = None self.version = None self.private_endpoint_connections = None + self.shared_private_link_resources = None self.tls = tls + self.features = features + self.cors = cors + self.upstream = upstream + self.network_ac_ls = network_ac_ls class SignalRResourceList(msrest.serialization.Model): - """Object that includes an array of SignalR services and a possible link for next set. + """Object that includes an array of resources and a possible link for next set. - :param value: List of SignalR services. + :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). @@ -1383,7 +1498,7 @@ def __init__( class SignalRTlsSettings(msrest.serialization.Model): - """TLS settings for SignalR. + """TLS settings for the resource. :param client_cert_enabled: Request client certificate during TLS handshake if enabled. :type client_cert_enabled: bool @@ -1404,7 +1519,7 @@ def __init__( class SignalRUsage(msrest.serialization.Model): - """Object that describes a specific usage of SignalR resources. + """Object that describes a specific usage of the resources. :param id: Fully qualified ARM resource id. :type id: str @@ -1447,9 +1562,9 @@ def __init__( class SignalRUsageList(msrest.serialization.Model): - """Object that includes an array of SignalR resource usages and a possible link for next set. + """Object that includes an array of the resource usages and a possible link for next set. - :param value: List of SignalR usages. + :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). @@ -1500,6 +1615,54 @@ def __init__( self.localized_value = localized_value +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.signalr.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.signalr.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class UpstreamAuthSettings(msrest.serialization.Model): """Upstream auth settings. 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 bf8127dd6fc2..9ae5f499548c 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 @@ -33,6 +33,15 @@ class ACLAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """FeatureFlags is the supported features of Azure SignalR service. @@ -43,11 +52,19 @@ class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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. """ SERVICE_MODE = "ServiceMode" ENABLE_CONNECTIVITY_LOGS = "EnableConnectivityLogs" ENABLE_MESSAGING_LOGS = "EnableMessagingLogs" + ENABLE_LIVE_TRACE = "EnableLiveTrace" class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). @@ -89,13 +106,22 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVING = "Moving" class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The kind of the service - e.g. "SignalR", or "RawWebSockets" for - "Microsoft.SignalRService/SignalR" + """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)): + """Status of the shared private link resource + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + TIMEOUT = "Timeout" + class SignalRRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. @@ -104,6 +130,7 @@ class SignalRRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CLIENT_CONNECTION = "ClientConnection" SERVER_CONNECTION = "ServerConnection" RESTAPI = "RESTAPI" + TRACE = "Trace" class SignalRSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Optional tier of this particular SKU. 'Standard' or 'Free'. diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py index df8e16c5da7b..5cd9fb86e467 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py @@ -8,14 +8,16 @@ from ._operations import Operations from ._signal_r_operations import SignalROperations +from ._usages_operations import UsagesOperations from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations -from ._usages_operations import UsagesOperations +from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations __all__ = [ 'Operations', 'SignalROperations', + 'UsagesOperations', 'SignalRPrivateEndpointConnectionsOperations', 'SignalRPrivateLinkResourcesOperations', - 'UsagesOperations', + 'SignalRSharedPrivateLinkResourcesOperations', ] 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 a88b38750135..6f79e6f51b7a 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 859ebee2c858..5e3874687786 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 @@ -50,11 +50,11 @@ def __init__(self, client, config, serializer, deserializer): def check_name_availability( self, location, # type: str - parameters=None, # type: Optional["_models.NameAvailabilityParameters"] + parameters, # type: "_models.NameAvailabilityParameters" **kwargs # type: Any ): # type: (...) -> "_models.NameAvailability" - """Checks that the SignalR name is valid and is not already in use. + """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str @@ -70,7 +70,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -92,10 +92,7 @@ def check_name_availability( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'NameAvailabilityParameters') - else: - body_content = None + 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) @@ -103,7 +100,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailability', pipeline_response) @@ -131,7 +128,7 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -171,7 +168,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -203,7 +200,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -244,7 +241,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -255,35 +252,35 @@ def get_next(next_link=None): ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR'} # type: ignore - def list_keys( + def get( self, resource_group_name, # type: str resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.SignalRKeys" - """Get the access keys of the SignalR resource. + # type: (...) -> "_models.SignalRResource" + """Get the resource and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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: SignalRKeys, or the result of cls(response) - :rtype: ~azure.mgmt.signalr.models.SignalRKeys + :return: SignalRResource, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SignalRResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self.list_keys.metadata['url'] # type: ignore + 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'), @@ -299,42 +296,42 @@ def list_keys( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.post(url, query_parameters, header_parameters) + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def _regenerate_key_initial( + def _create_or_update_initial( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.RegenerateKeyParameters"] + parameters, # type: "_models.SignalRResource" **kwargs # type: Any ): - # type: (...) -> "_models.SignalRKeys" - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + # type: (...) -> Optional["_models.SignalRResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._regenerate_key_initial.metadata['url'] # type: ignore + 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'), @@ -352,65 +349,66 @@ def _regenerate_key_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') - else: - body_content = None + body_content = self._serialize.body(parameters, 'SignalRResource') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + 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 [201]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SignalRResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def begin_regenerate_key( + def begin_create_or_update( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.RegenerateKeyParameters"] + parameters, # type: "_models.SignalRResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.SignalRKeys"] - """Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the - same time. + # type: (...) -> LROPoller["_models.SignalRResource"] + """Create or update a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameter that describes the Regenerate Key Operation. - :type parameters: ~azure.mgmt.signalr.models.RegenerateKeyParameters + :param parameters: Parameters for the create or update operation. + :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SignalRKeys] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._regenerate_key_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -422,7 +420,7 @@ def begin_regenerate_key( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SignalRKeys', pipeline_response) + deserialized = self._deserialize('SignalRResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -434,7 +432,7 @@ def get_long_running_output(pipeline_response): '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, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,37 +444,25 @@ 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 + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def get( + def _delete_initial( self, resource_group_name, # type: str resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.SignalRResource" - """Get the SignalR service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SignalRResource, or the result of cls(response) - :rtype: ~azure.mgmt.signalr.models.SignalRResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self.get.metadata['url'] # type: ignore + 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'), @@ -492,28 +478,91 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) + 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]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SignalRResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def _create_or_update_initial( + def begin_delete( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.SignalRResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Operation to delete a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.SignalRResource" **kwargs # type: Any ): # type: (...) -> Optional["_models.SignalRResource"] @@ -522,12 +571,12 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), @@ -545,54 +594,48 @@ def _create_or_update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'SignalRResource') - else: - body_content = None + 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) + 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, 201, 202]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SignalRResource', pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize('SignalRResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def begin_create_or_update( + def begin_update( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.SignalRResource"] + parameters, # type: "_models.SignalRResource" **kwargs # type: Any ): # type: (...) -> LROPoller["_models.SignalRResource"] - """Create a new SignalR service and update an exiting SignalR service. + """Operation to update an exiting resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameters for the create or update operation. + :param parameters: Parameters for the update operation. :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -607,7 +650,7 @@ def begin_create_or_update( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -643,25 +686,37 @@ 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 + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore - def _delete_initial( + def list_keys( self, resource_group_name, # type: str resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + # type: (...) -> "_models.SignalRKeys" + """Get the access keys of the resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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: SignalRKeys, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SignalRKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + 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'), @@ -677,105 +732,42 @@ def _delete_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + 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]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, 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 - - def begin_delete( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Operation to delete a SignalR service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - 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, {}) + deserialized = self._deserialize('SignalRKeys', pipeline_response) - path_format_arguments = { - '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 cls: + return cls(pipeline_response, deserialized, {}) - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} # type: ignore - def _update_initial( + def _regenerate_key_initial( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.SignalRResource"] + parameters, # type: "_models.RegenerateKeyParameters" **kwargs # type: Any ): - # type: (...) -> Optional["_models.SignalRResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SignalRResource"]] + # type: (...) -> "_models.SignalRKeys" + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._update_initial.metadata['url'] # type: ignore + 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'), @@ -793,66 +785,62 @@ def _update_initial( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'SignalRResource') - else: - body_content = None + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + 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, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SignalRResource', pipeline_response) + deserialized = self._deserialize('SignalRKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore - def begin_update( + def begin_regenerate_key( self, resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.SignalRResource"] + parameters, # type: "_models.RegenerateKeyParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.SignalRResource"] - """Operation to update an exiting SignalR service. + # type: (...) -> LROPoller["_models.SignalRKeys"] + """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated + at the same time. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str - :param parameters: Parameters for the update operation. - :type parameters: ~azure.mgmt.signalr.models.SignalRResource + :param parameters: Parameter that describes the Regenerate Key Operation. + :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SignalRResource] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRKeys"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._regenerate_key_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -864,7 +852,7 @@ def begin_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SignalRResource', pipeline_response) + deserialized = self._deserialize('SignalRKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -876,7 +864,7 @@ def get_long_running_output(pipeline_response): '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, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -888,7 +876,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} # type: ignore + begin_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} # type: ignore def _restart_initial( self, @@ -902,7 +890,7 @@ def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -928,7 +916,7 @@ def _restart_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -943,17 +931,17 @@ def begin_restart( **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Operation to restart a SignalR service. + """Operation to restart a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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 :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) 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 44eb3527b789..48704a9fd2c7 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 @@ -9,6 +9,7 @@ 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.polling import LROPoller, NoPolling, PollingMethod @@ -19,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + 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]] @@ -46,6 +47,83 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] + """List private endpoint connections. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.PrivateEndpointConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + def get( self, private_endpoint_connection_name, # type: str @@ -54,15 +132,14 @@ def get( **kwargs # type: Any ): # type: (...) -> "_models.PrivateEndpointConnection" - """Get the specified private endpoint connection associated with a SignalR resource. + """Get the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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: PrivateEndpointConnection, or the result of cls(response) @@ -74,7 +151,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -101,7 +178,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -117,19 +194,18 @@ def update( private_endpoint_connection_name, # type: str resource_group_name, # type: str resource_name, # type: str - parameters=None, # type: Optional["_models.PrivateEndpointConnection"] + parameters, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): # type: (...) -> "_models.PrivateEndpointConnection" - """Update the state of specified private endpoint connection associated with a SignalR resource. + """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :param resource_name: The name of the resource. :type resource_name: str :param parameters: The resource of private endpoint and its properties. :type parameters: ~azure.mgmt.signalr.models.PrivateEndpointConnection @@ -143,7 +219,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -167,10 +243,7 @@ def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - else: - body_content = None + 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) @@ -178,7 +251,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -202,7 +275,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" # Construct URL @@ -227,9 +300,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -245,20 +318,19 @@ def begin_delete( **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Delete the specified private endpoint connection associated with a SignalR resource. + """Delete the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the SignalR resource. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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 :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) 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 b10852c2fccd..847613b41b01 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 @@ -52,12 +52,12 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["_models.PrivateLinkResourceList"] - """Get the private link resources that need to be created for a SignalR resource. + """Get the private link resources that need to be created for a resource. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param resource_name: The name of the SignalR resource. + :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) @@ -69,7 +69,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -111,7 +111,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 new file mode 100644 index 000000000000..c5f5ffc30cfb --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py @@ -0,0 +1,448 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SignalRSharedPrivateLinkResourcesOperations(object): + """SignalRSharedPrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.signalr.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedPrivateLinkResourceList"] + """List shared private link resources. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.SharedPrivateLinkResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def get( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedPrivateLinkResource" + """Get the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def _create_or_update_initial( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.SharedPrivateLinkResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedPrivateLinkResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + 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 + + def begin_create_or_update( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.SharedPrivateLinkResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SharedPrivateLinkResource"] + """Create or update a shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The shared private link resource. + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def _delete_initial( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def begin_delete( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 e63974b50cbc..35e906fd3db2 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 @@ -51,7 +51,7 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["_models.SignalRUsageList"] - """List usage quotas for Azure SignalR service by location. + """List resource usage quotas by location. :param location: the location like "eastus". :type location: str @@ -65,7 +65,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-04-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)