From 83893ca38064d3d1e0e361dadc01d3832470ea4c Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 5 Nov 2020 02:27:39 +0000 Subject: [PATCH] Generated from af3fae7cd65f1b4588fdbb5ff9dc8f662e0e0776 --- .../azure-mgmt-communication/README.md | 10 ++- ...communication_service_management_client.py | 2 +- .../mgmt/communication/_configuration.py | 2 +- .../azure/mgmt/communication/_metadata.json | 4 +- .../azure/mgmt/communication/_version.py | 2 +- ...communication_service_management_client.py | 2 +- .../mgmt/communication/aio/_configuration.py | 2 +- .../_communication_service_operations.py | 82 ++++++++++++++++-- .../mgmt/communication/models/__init__.py | 6 ++ .../mgmt/communication/models/_models.py | 61 +++++++++++++- .../mgmt/communication/models/_models_py3.py | 68 ++++++++++++++- .../_communication_service_operations.py | 83 +++++++++++++++++-- .../azure-mgmt-communication/setup.py | 2 +- 13 files changed, 296 insertions(+), 30 deletions(-) diff --git a/sdk/communication/azure-mgmt-communication/README.md b/sdk/communication/azure-mgmt-communication/README.md index 410c401d198..1ad524c1bd3 100644 --- a/sdk/communication/azure-mgmt-communication/README.md +++ b/sdk/communication/azure-mgmt-communication/README.md @@ -7,8 +7,14 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( # Usage -For code examples, see [Communication Management](https://docs.microsoft.com/python/api/overview/azure/) -on docs.microsoft.com. + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Communication Management](https://docs.microsoft.com/samples/azure-samples/azure-samples-python-management/) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) # Provide Feedback diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py index ad715259f92..9aa9c79b216 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py @@ -35,7 +35,7 @@ class CommunicationServiceManagementClient(object): :vartype operation_statuses: communication_service_management_client.operations.OperationStatusesOperations :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 identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py index 4a1bbc2fe91..5aaa3965359 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py @@ -29,7 +29,7 @@ class CommunicationServiceManagementClientConfiguration(Configuration): :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 identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json index 3ab71a6ca06..24dc4c48c15 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json @@ -20,7 +20,7 @@ }, "subscription_id": { "method_signature": "subscription_id, # type: str", - "description": "Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -34,7 +34,7 @@ }, "subscription_id": { "method_signature": "subscription_id, # type: str", - "description": "Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py index 20971492f12..3b909b5c888 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0rc1" diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py index 21ac1e1b24b..76b063f7e8d 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py @@ -33,7 +33,7 @@ class CommunicationServiceManagementClient(object): :vartype operation_statuses: communication_service_management_client.aio.operations.OperationStatusesOperations :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 identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py index adc2ace4b00..c9f48744e6a 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py @@ -27,7 +27,7 @@ class CommunicationServiceManagementClientConfiguration(Configuration): :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 identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_service_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_service_operations.py index ccb32911951..9d1db732b55 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_service_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_service_operations.py @@ -43,6 +43,70 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + async def check_name_availability( + self, + name_availability_parameters: Optional["models.NameAvailabilityParameters"] = None, + **kwargs + ) -> "models.NameAvailability": + """Check Name Availability. + + Checks that the CommunicationService name is valid and is not already in use. + + :param name_availability_parameters: Parameters supplied to the operation. + :type name_availability_parameters: ~communication_service_management_client.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~communication_service_management_client.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-08-20-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(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] + if name_availability_parameters is not None: + body_content = self._serialize.body(name_availability_parameters, 'NameAvailabilityParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability'} # type: ignore + async def link_notification_hub( self, resource_group_name: str, @@ -78,7 +142,7 @@ async def link_notification_hub( # Construct URL url = self.link_notification_hub.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -146,7 +210,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -219,7 +283,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -294,7 +358,7 @@ async def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -363,7 +427,7 @@ async def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -413,7 +477,7 @@ async def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -545,7 +609,7 @@ async def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -669,7 +733,7 @@ async def list_keys( # Construct URL url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -736,7 +800,7 @@ async def regenerate_key( # Construct URL url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py index 8539461ac04..9b1c0f734ca 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py @@ -17,6 +17,8 @@ from ._models_py3 import LinkedNotificationHub from ._models_py3 import LocationResource from ._models_py3 import MetricSpecification + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationList @@ -37,6 +39,8 @@ from ._models import LinkedNotificationHub # type: ignore from ._models import LocationResource # type: ignore from ._models import MetricSpecification # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationList # type: ignore @@ -65,6 +69,8 @@ 'LinkedNotificationHub', 'LocationResource', 'MetricSpecification', + 'NameAvailability', + 'NameAvailabilityParameters', 'Operation', 'OperationDisplay', 'OperationList', diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models.py index d9dc2fafdd9..959f9c5ad2b 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models.py @@ -413,6 +413,65 @@ def __init__( self.dimensions = kwargs.get('dimensions', None) +class NameAvailability(msrest.serialization.Model): + """Result of the request to check name availability. It contains a flag and possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Should be always + "Microsoft.Communication/CommunicationServices". + :type type: str + :param name: Required. The CommunicationService name to validate. e.g."my-CommunicationService- + name-here". + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = kwargs['type'] + self.name = kwargs['name'] + + class Operation(msrest.serialization.Model): """REST API operation supported by CommunicationService resource provider. @@ -526,7 +585,7 @@ class OperationStatus(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The operation Id. + :ivar id: Fully qualified ID for the operation status. :vartype id: str :ivar status: Provisioning state of the resource. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", "Moving". diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py index 31cbf6dae6f..4218612797e 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py @@ -457,6 +457,72 @@ def __init__( self.dimensions = dimensions +class NameAvailability(msrest.serialization.Model): + """Result of the request to check name availability. It contains a flag and possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Should be always + "Microsoft.Communication/CommunicationServices". + :type type: str + :param name: Required. The CommunicationService name to validate. e.g."my-CommunicationService- + name-here". + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name + + class Operation(msrest.serialization.Model): """REST API operation supported by CommunicationService resource provider. @@ -585,7 +651,7 @@ class OperationStatus(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The operation Id. + :ivar id: Fully qualified ID for the operation status. :vartype id: str :ivar status: Provisioning state of the resource. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", "Moving". diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_service_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_service_operations.py index 24035d3ab19..908cb68808d 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_service_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_service_operations.py @@ -47,6 +47,71 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def check_name_availability( + self, + name_availability_parameters=None, # type: Optional["models.NameAvailabilityParameters"] + **kwargs # type: Any + ): + # type: (...) -> "models.NameAvailability" + """Check Name Availability. + + Checks that the CommunicationService name is valid and is not already in use. + + :param name_availability_parameters: Parameters supplied to the operation. + :type name_availability_parameters: ~communication_service_management_client.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~communication_service_management_client.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-08-20-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(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] + if name_availability_parameters is not None: + body_content = self._serialize.body(name_availability_parameters, 'NameAvailabilityParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability'} # type: ignore + def link_notification_hub( self, resource_group_name, # type: str @@ -83,7 +148,7 @@ def link_notification_hub( # Construct URL url = self.link_notification_hub.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -152,7 +217,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -226,7 +291,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -302,7 +367,7 @@ def update( # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -372,7 +437,7 @@ def get( # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -423,7 +488,7 @@ def _create_or_update_initial( # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -557,7 +622,7 @@ def _delete_initial( # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -683,7 +748,7 @@ def list_keys( # Construct URL url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } @@ -751,7 +816,7 @@ def regenerate_key( # Construct URL url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), } diff --git a/sdk/communication/azure-mgmt-communication/setup.py b/sdk/communication/azure-mgmt-communication/setup.py index c8c75f91076..6394772357e 100644 --- a/sdk/communication/azure-mgmt-communication/setup.py +++ b/sdk/communication/azure-mgmt-communication/setup.py @@ -81,8 +81,8 @@ ]), install_requires=[ 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', - 'azure-mgmt-core>=1.2.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'],