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 ad715259f923a..98c6538d3be8e 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. @@ -56,6 +56,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.operations = Operations( 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 4a1bbc2fe91a7..640d900bbf711 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 """ @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-08-20-preview" + self.api_version = "2020-08-20" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-communication/{}'.format(VERSION)) self._configure(**kwargs) 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 3ab71a6ca06cf..26090e12d418d 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2020-08-20-preview", - "total_api_version_list": ["2020-08-20-preview"], + "chosen_version": "2020-08-20", + "total_api_version_list": ["2020-08-20"], "client": { "name": "CommunicationServiceManagementClient", "filename": "_communication_service_management_client", @@ -8,33 +8,34 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": false }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "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.", + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "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.", + "signature": "subscription_id, # type: str", + "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 9cf33092d41b2..c47f66669f1bf 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.0b5" +VERSION = "1.0.0" 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 21ac1e1b24bf3..daa027cf4da5c 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. @@ -53,6 +53,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.operations = Operations( 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 adc2ace4b006d..6df95a18905d8 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 """ @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-08-20-preview" + self.api_version = "2020-08-20" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-communication/{}'.format(VERSION)) self._configure(**kwargs) 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 ccb3291195186..5abff16a67917 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class CommunicationServiceOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,19 +43,82 @@ 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" + 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, communication_service_name: str, - link_notification_hub_parameters: Optional["models.LinkNotificationHubParameters"] = None, + link_notification_hub_parameters: Optional["_models.LinkNotificationHubParameters"] = None, **kwargs - ) -> "models.LinkedNotificationHub": + ) -> "_models.LinkedNotificationHub": """Link Notification Hub. Links an Azure Notification Hub to this communication 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -66,21 +129,21 @@ async def link_notification_hub( :rtype: ~communication_service_management_client.models.LinkedNotificationHub :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedNotificationHub"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedNotificationHub"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -105,7 +168,7 @@ async def link_notification_hub( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedNotificationHub', pipeline_response) @@ -119,7 +182,7 @@ async def link_notification_hub( def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.CommunicationServiceResourceList"]: + ) -> AsyncIterable["_models.CommunicationServiceResourceList"]: """List By Subscription. Handles requests to list all resources in a subscription. @@ -129,12 +192,12 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -146,7 +209,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 @@ -174,7 +237,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(_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) @@ -189,25 +252,24 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.CommunicationServiceResourceList"]: + ) -> AsyncIterable["_models.CommunicationServiceResourceList"]: """List By Resource Group. Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -219,8 +281,8 @@ 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -248,7 +310,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(_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) @@ -263,40 +325,39 @@ async def update( self, resource_group_name: str, communication_service_name: str, - parameters: Optional["models.TaggedResource"] = None, + parameters: Optional["_models.CommunicationServiceResource"] = None, **kwargs - ) -> "models.CommunicationServiceResource": + ) -> "_models.CommunicationServiceResource": """Update. Operation to update an existing CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str :param parameters: Parameters for the update operation. - :type parameters: ~communication_service_management_client.models.TaggedResource + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceResource, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -311,7 +372,7 @@ async def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'TaggedResource') + body_content = self._serialize.body(parameters, 'CommunicationServiceResource') else: body_content = None body_content_kwargs['content'] = body_content @@ -321,7 +382,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) @@ -337,13 +398,12 @@ async def get( resource_group_name: str, communication_service_name: str, **kwargs - ) -> "models.CommunicationServiceResource": + ) -> "_models.CommunicationServiceResource": """Get. Get the CommunicationService 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -352,20 +412,20 @@ async def get( :rtype: ~communication_service_management_client.models.CommunicationServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -383,7 +443,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) @@ -398,24 +458,24 @@ async def _create_or_update_initial( self, resource_group_name: str, communication_service_name: str, - parameters: Optional["models.CommunicationServiceResource"] = None, + parameters: Optional["_models.CommunicationServiceResource"] = None, **kwargs - ) -> "models.CommunicationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + ) -> "_models.CommunicationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -440,7 +500,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -461,15 +521,14 @@ async def begin_create_or_update( self, resource_group_name: str, communication_service_name: str, - parameters: Optional["models.CommunicationServiceResource"] = None, + parameters: Optional["_models.CommunicationServiceResource"] = None, **kwargs - ) -> AsyncLROPoller["models.CommunicationServiceResource"]: + ) -> AsyncLROPoller["_models.CommunicationServiceResource"]: """Create Or Update. Create a new CommunicationService or update an existing CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -486,7 +545,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,16 +564,19 @@ async def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), + } + + 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: @@ -539,15 +601,15 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -565,7 +627,7 @@ async def _delete_initial( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -587,8 +649,7 @@ async def begin_delete( Operation to delete a CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -624,7 +685,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -643,13 +710,12 @@ async def list_keys( resource_group_name: str, communication_service_name: str, **kwargs - ) -> "models.CommunicationServiceKeys": + ) -> "_models.CommunicationServiceKeys": """List Keys. Get the access keys of the CommunicationService 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -658,20 +724,20 @@ async def list_keys( :rtype: ~communication_service_management_client.models.CommunicationServiceKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -689,7 +755,7 @@ async def list_keys( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) @@ -704,16 +770,15 @@ async def regenerate_key( self, resource_group_name: str, communication_service_name: str, - parameters: Optional["models.RegenerateKeyParameters"] = None, + parameters: "_models.RegenerateKeyParameters", **kwargs - ) -> "models.CommunicationServiceKeys": + ) -> "_models.CommunicationServiceKeys": """Regenerate Key. Regenerate CommunicationService access key. 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -724,21 +789,21 @@ async def regenerate_key( :rtype: ~communication_service_management_client.models.CommunicationServiceKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -752,25 +817,18 @@ async def regenerate_key( 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, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) + deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operation_statuses_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operation_statuses_operations.py index bfa993e7b8f0b..9ed69ae5dc49c 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operation_statuses_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operation_statuses_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class OperationStatusesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get( location: str, operation_id: str, **kwargs - ) -> "models.OperationStatus": + ) -> "_models.OperationStatus": """Get Operation Status. Gets the current status of an async operation. @@ -59,12 +59,12 @@ async def get( :rtype: ~communication_service_management_client.models.OperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL @@ -89,7 +89,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatus', pipeline_response) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py index 7968eb3c2fd30..aaf2bb39694dc 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,22 +44,22 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationList"]: + ) -> AsyncIterable["_models.OperationListResult"]: """List Operations. Lists all of the available REST API operations of the Microsoft.Communication provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.OperationList] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -82,7 +82,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,7 +95,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(_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/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py index 8539461ac04b1..8485e0905ace1 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 @@ -10,46 +10,48 @@ from ._models_py3 import CommunicationServiceKeys from ._models_py3 import CommunicationServiceResource from ._models_py3 import CommunicationServiceResourceList - from ._models_py3 import Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseError from ._models_py3 import LinkNotificationHubParameters 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 - from ._models_py3 import OperationProperties + from ._models_py3 import OperationListResult from ._models_py3 import OperationStatus from ._models_py3 import RegenerateKeyParameters from ._models_py3 import Resource - from ._models_py3 import ServiceSpecification + from ._models_py3 import SystemData from ._models_py3 import TaggedResource except (SyntaxError, ImportError): from ._models import CommunicationServiceKeys # type: ignore from ._models import CommunicationServiceResource # type: ignore from ._models import CommunicationServiceResourceList # type: ignore - 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 ErrorResponseError # type: ignore from ._models import LinkNotificationHubParameters # type: ignore 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 - from ._models import OperationProperties # type: ignore + from ._models import OperationListResult # type: ignore from ._models import OperationStatus # type: ignore from ._models import RegenerateKeyParameters # type: ignore from ._models import Resource # type: ignore - from ._models import ServiceSpecification # type: ignore + from ._models import SystemData # type: ignore from ._models import TaggedResource # type: ignore from ._communication_service_management_client_enums import ( - AggregationType, + ActionType, + CreatedByType, KeyType, + Origin, ProvisioningState, Status, ) @@ -58,24 +60,26 @@ 'CommunicationServiceKeys', 'CommunicationServiceResource', 'CommunicationServiceResourceList', - 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorDetail', 'ErrorResponse', - 'ErrorResponseError', 'LinkNotificationHubParameters', 'LinkedNotificationHub', 'LocationResource', - 'MetricSpecification', + 'NameAvailability', + 'NameAvailabilityParameters', 'Operation', 'OperationDisplay', - 'OperationList', - 'OperationProperties', + 'OperationListResult', 'OperationStatus', 'RegenerateKeyParameters', 'Resource', - 'ServiceSpecification', + 'SystemData', 'TaggedResource', - 'AggregationType', + 'ActionType', + 'CreatedByType', 'KeyType', + 'Origin', 'ProvisioningState', 'Status', ] diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py index d7eeddc32d095..f970f772a6001 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py @@ -26,15 +26,20 @@ def __getattr__(cls, name): raise AttributeError(name) -class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The method for aggregating the metric. +class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ - AVERAGE = "Average" - MINIMUM = "Minimum" - MAXIMUM = "Maximum" - TOTAL = "Total" - COUNT = "Count" + INTERNAL = "Internal" + +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 KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). @@ -43,6 +48,15 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PRIMARY = "Primary" SECONDARY = "Secondary" +class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ 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 d9dc2fafdd9b5..18183f3153727 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 @@ -83,15 +83,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -127,12 +129,16 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): :type tags: dict[str, str] :param location: The Azure location where the CommunicationService is running. :type location: str - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~communication_service_management_client.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -155,6 +161,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'host_name': {'readonly': True}, 'notification_hub_id': {'readonly': True}, @@ -168,6 +175,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): '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'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'data_location': {'key': 'properties.dataLocation', 'type': 'str'}, @@ -183,6 +191,7 @@ def __init__( super(CommunicationServiceResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.location = kwargs.get('location', None) + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -193,6 +202,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -203,6 +213,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -236,78 +247,99 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class Dimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.internal_name = kwargs.get('internal_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicating why the requested operation could not be performed. +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :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[~communication_service_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~communication_service_management_client.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class ErrorResponseError(msrest.serialization.Model): - """The error. +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 code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class LinkedNotificationHub(msrest.serialization.Model): @@ -359,79 +391,100 @@ def __init__( self.connection_string = kwargs['connection_string'] -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. +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 name: Name of the metric. + :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 - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: The method for aggregating the metric. Possible values include: - "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~communication_service_management_client.models.AggregationType - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - Ex. a metric that returns the number of times a particular error code was emitted. The error - code may not appear - often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~communication_service_management_client.models.Dimension] """ + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, } def __init__( self, **kwargs ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.dimensions = kwargs.get('dimensions', None) + 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. + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. :type display: ~communication_service_management_client.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~communication_service_management_client.models.OperationProperties + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~communication_service_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~communication_service_management_client.models.ActionType """ + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( @@ -439,25 +492,39 @@ def __init__( **kwargs ): super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = None + self.is_data_action = None self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): - """The object that describes a operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -470,55 +537,40 @@ def __init__( **kwargs ): super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationList(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~communication_service_management_client.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~communication_service_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: The service specifications. - :type service_specification: - ~communication_service_management_client.models.ServiceSpecification - """ - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None class OperationStatus(msrest.serialization.Model): @@ -526,7 +578,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". @@ -537,8 +589,8 @@ class OperationStatus(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar percent_complete: Percent of the operation that is complete. :vartype percent_complete: float - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _validation = { @@ -555,7 +607,7 @@ class OperationStatus(msrest.serialization.Model): 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - 'error': {'key': 'error.error', 'type': 'ErrorResponseError'}, + 'error': {'key': 'error.error', 'type': 'ErrorDetail'}, } def __init__( @@ -591,21 +643,43 @@ def __init__( self.key_type = kwargs.get('key_type', None) -class ServiceSpecification(msrest.serialization.Model): - """An object that describes a specification. - - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: - list[~communication_service_management_client.models.MetricSpecification] +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 ~communication_service_management_client.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 + ~communication_service_management_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + '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(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) + 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) 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 31cbf6dae6fd0..00376005cd4e7 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 @@ -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 @@ -96,15 +97,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -140,12 +143,16 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): :type tags: dict[str, str] :param location: The Azure location where the CommunicationService is running. :type location: str - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~communication_service_management_client.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -168,6 +175,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'host_name': {'readonly': True}, 'notification_hub_id': {'readonly': True}, @@ -181,6 +189,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): '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'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'data_location': {'key': 'properties.dataLocation', 'type': 'str'}, @@ -200,6 +209,7 @@ def __init__( super(CommunicationServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.tags = tags self.location = location + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -210,6 +220,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -220,6 +231,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -256,88 +268,101 @@ def __init__( self.next_link = next_link -class Dimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - internal_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - super(Dimension, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.internal_name = internal_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicating why the requested operation could not be performed. +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :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[~communication_service_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~communication_service_management_client.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, - *, - error: Optional["ErrorResponseError"] = None, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class ErrorResponseError(msrest.serialization.Model): - """The error. +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 code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) - self.code = code - self.message = message + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class LinkedNotificationHub(msrest.serialization.Model): @@ -394,119 +419,149 @@ def __init__( self.connection_string = connection_string -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. +class NameAvailability(msrest.serialization.Model): + """Result of the request to check name availability. It contains a flag and possible reason of failure. - :param name: Name of the metric. + :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 - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: The method for aggregating the metric. Possible values include: - "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~communication_service_management_client.models.AggregationType - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - Ex. a metric that returns the number of times a particular error code was emitted. The error - code may not appear - often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~communication_service_management_client.models.Dimension] """ + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, } def __init__( self, *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - aggregation_type: Optional[Union[str, "AggregationType"]] = None, - fill_gap_with_zero: Optional[str] = None, - category: Optional[str] = None, - dimensions: Optional[List["Dimension"]] = None, + type: str, + name: str, **kwargs ): - super(MetricSpecification, self).__init__(**kwargs) + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.fill_gap_with_zero = fill_gap_with_zero - self.category = category - self.dimensions = dimensions class Operation(msrest.serialization.Model): - """REST API operation supported by CommunicationService resource provider. + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. :type display: ~communication_service_management_client.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~communication_service_management_client.models.OperationProperties + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~communication_service_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~communication_service_management_client.models.ActionType """ + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, *, - name: Optional[str] = None, display: Optional["OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["OperationProperties"] = None, **kwargs ): super(Operation, self).__init__(**kwargs) - self.name = name + self.name = None + self.is_data_action = None self.display = display - self.origin = origin - self.properties = properties + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): - """The object that describes a operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -516,68 +571,43 @@ class OperationDisplay(msrest.serialization.Model): def __init__( self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, **kwargs ): super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationList(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~communication_service_management_client.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~communication_service_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: The service specifications. - :type service_specification: - ~communication_service_management_client.models.ServiceSpecification - """ - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = service_specification + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None class OperationStatus(msrest.serialization.Model): @@ -585,7 +615,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". @@ -596,8 +626,8 @@ class OperationStatus(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar percent_complete: Percent of the operation that is complete. :vartype percent_complete: float - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _validation = { @@ -614,13 +644,13 @@ class OperationStatus(msrest.serialization.Model): 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - 'error': {'key': 'error.error', 'type': 'ErrorResponseError'}, + 'error': {'key': 'error.error', 'type': 'ErrorDetail'}, } def __init__( self, *, - error: Optional["ErrorResponseError"] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): super(OperationStatus, self).__init__(**kwargs) @@ -654,23 +684,50 @@ def __init__( self.key_type = key_type -class ServiceSpecification(msrest.serialization.Model): - """An object that describes a specification. - - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: - list[~communication_service_management_client.models.MetricSpecification] +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 ~communication_service_management_client.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 + ~communication_service_management_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + '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, *, - metric_specifications: Optional[List["MetricSpecification"]] = None, + 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(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = metric_specifications + 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 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 24035d3ab1915..7137e3adce1af 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class CommunicationServiceOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -47,20 +47,84 @@ 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" + 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 communication_service_name, # type: str - link_notification_hub_parameters=None, # type: Optional["models.LinkNotificationHubParameters"] + link_notification_hub_parameters=None, # type: Optional["_models.LinkNotificationHubParameters"] **kwargs # type: Any ): - # type: (...) -> "models.LinkedNotificationHub" + # type: (...) -> "_models.LinkedNotificationHub" """Link Notification Hub. Links an Azure Notification Hub to this communication 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -71,21 +135,21 @@ def link_notification_hub( :rtype: ~communication_service_management_client.models.LinkedNotificationHub :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedNotificationHub"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedNotificationHub"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -110,7 +174,7 @@ def link_notification_hub( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedNotificationHub', pipeline_response) @@ -125,7 +189,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.CommunicationServiceResourceList"] + # type: (...) -> Iterable["_models.CommunicationServiceResourceList"] """List By Subscription. Handles requests to list all resources in a subscription. @@ -135,12 +199,12 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -152,7 +216,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 @@ -180,7 +244,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(_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,25 +260,24 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.CommunicationServiceResourceList"] + # type: (...) -> Iterable["_models.CommunicationServiceResourceList"] """List By Resource Group. Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -226,8 +289,8 @@ 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -255,7 +318,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(_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) @@ -270,41 +333,40 @@ def update( self, resource_group_name, # type: str communication_service_name, # type: str - parameters=None, # type: Optional["models.TaggedResource"] + parameters=None, # type: Optional["_models.CommunicationServiceResource"] **kwargs # type: Any ): - # type: (...) -> "models.CommunicationServiceResource" + # type: (...) -> "_models.CommunicationServiceResource" """Update. Operation to update an existing CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str :param parameters: Parameters for the update operation. - :type parameters: ~communication_service_management_client.models.TaggedResource + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceResource, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -319,7 +381,7 @@ def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'TaggedResource') + body_content = self._serialize.body(parameters, 'CommunicationServiceResource') else: body_content = None body_content_kwargs['content'] = body_content @@ -329,7 +391,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) @@ -346,13 +408,12 @@ def get( communication_service_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.CommunicationServiceResource" + # type: (...) -> "_models.CommunicationServiceResource" """Get. Get the CommunicationService 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -361,20 +422,20 @@ def get( :rtype: ~communication_service_management_client.models.CommunicationServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -392,7 +453,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) @@ -407,25 +468,25 @@ def _create_or_update_initial( self, resource_group_name, # type: str communication_service_name, # type: str - parameters=None, # type: Optional["models.CommunicationServiceResource"] + parameters=None, # type: Optional["_models.CommunicationServiceResource"] **kwargs # type: Any ): - # type: (...) -> "models.CommunicationServiceResource" - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + # type: (...) -> "_models.CommunicationServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -450,7 +511,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -471,16 +532,15 @@ def begin_create_or_update( self, resource_group_name, # type: str communication_service_name, # type: str - parameters=None, # type: Optional["models.CommunicationServiceResource"] + parameters=None, # type: Optional["_models.CommunicationServiceResource"] **kwargs # type: Any ): - # type: (...) -> LROPoller["models.CommunicationServiceResource"] + # type: (...) -> LROPoller["_models.CommunicationServiceResource"] """Create Or Update. Create a new CommunicationService or update an existing CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -497,7 +557,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -516,16 +576,19 @@ def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), + } + + 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: @@ -551,15 +614,15 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -577,7 +640,7 @@ def _delete_initial( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -600,8 +663,7 @@ def begin_delete( Operation to delete a CommunicationService. - :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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -637,7 +699,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,13 +725,12 @@ def list_keys( communication_service_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.CommunicationServiceKeys" + # type: (...) -> "_models.CommunicationServiceKeys" """List Keys. Get the access keys of the CommunicationService 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -672,20 +739,20 @@ def list_keys( :rtype: ~communication_service_management_client.models.CommunicationServiceKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -703,7 +770,7 @@ def list_keys( 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) @@ -718,17 +785,16 @@ def regenerate_key( self, resource_group_name, # type: str communication_service_name, # type: str - parameters=None, # type: Optional["models.RegenerateKeyParameters"] + parameters, # type: "_models.RegenerateKeyParameters" **kwargs # type: Any ): - # type: (...) -> "models.CommunicationServiceKeys" + # type: (...) -> "_models.CommunicationServiceKeys" """Regenerate Key. Regenerate CommunicationService access key. 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -739,21 +805,21 @@ def regenerate_key( :rtype: ~communication_service_management_client.models.CommunicationServiceKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationServiceKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, '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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -767,25 +833,18 @@ def regenerate_key( 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, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) + deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operation_statuses_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operation_statuses_operations.py index 9e3f99b57d160..7547d5c551725 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operation_statuses_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operation_statuses_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class OperationStatusesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.OperationStatus" + # type: (...) -> "_models.OperationStatus" """Get Operation Status. Gets the current status of an async operation. @@ -64,12 +64,12 @@ def get( :rtype: ~communication_service_management_client.models.OperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL @@ -94,7 +94,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(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatus', pipeline_response) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py index 08cc4b001b866..a8d25311b423f 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,22 +49,22 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationList"] + # type: (...) -> Iterable["_models.OperationListResult"] """List Operations. Lists all of the available REST API operations of the Microsoft.Communication provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.OperationList] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -87,7 +87,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,7 +100,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(_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)