From 26442d8b6aeb936d31446bc7fe5a86bc182dd95d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Dec 2020 08:03:21 +0000 Subject: [PATCH] CodeGen from PR 12162 in Azure/azure-rest-api-specs Swagger Linting Fix (#12162) * Fix Linting Issuing * no message * fix description * add description and object back * test to resolve model validation test (cherry picked from commit ab273dfc0d5897683c128ee15da4babafa7a85ba) --- .../mgmt/powerbidedicated/models/__init__.py | 3 + .../mgmt/powerbidedicated/models/_models.py | 32 ++++++-- .../powerbidedicated/models/_models_py3.py | 34 +++++--- .../operations/_capacities_operations.py | 78 ++++++++----------- 4 files changed, 85 insertions(+), 62 deletions(-) diff --git a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/__init__.py b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/__init__.py index 10c803f3bf2b..a8f6e74ecb32 100644 --- a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/__init__.py +++ b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/__init__.py @@ -16,6 +16,7 @@ from ._models_py3 import DedicatedCapacityAdministrators from ._models_py3 import DedicatedCapacityUpdateParameters from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseError from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import Resource @@ -30,6 +31,7 @@ from ._models import DedicatedCapacityAdministrators from ._models import DedicatedCapacityUpdateParameters from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseError from ._models import Operation from ._models import OperationDisplay from ._models import Resource @@ -52,6 +54,7 @@ 'DedicatedCapacityAdministrators', 'DedicatedCapacityUpdateParameters', 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseError', 'Operation', 'OperationDisplay', 'Resource', diff --git a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models.py b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models.py index c84f4f1ffd1e..5827033f37c1 100644 --- a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models.py +++ b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models.py @@ -232,21 +232,17 @@ def __init__(self, **kwargs): class ErrorResponse(Model): """Describes the format of Error response. - :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: ~azure.mgmt.powerbidedicated.models.ErrorResponseError """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, } def __init__(self, **kwargs): super(ErrorResponse, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + self.error = kwargs.get('error', None) class ErrorResponseException(HttpOperationError): @@ -261,6 +257,26 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +class ErrorResponseError(Model): + """The error object. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + class Operation(Model): """Capacities REST API operation. diff --git a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models_py3.py b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models_py3.py index 3069ecfff800..2feaf108a9f6 100644 --- a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models_py3.py +++ b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/_models_py3.py @@ -232,21 +232,17 @@ def __init__(self, *, sku=None, tags=None, administration=None, **kwargs) -> Non class ErrorResponse(Model): """Describes the format of Error response. - :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: ~azure.mgmt.powerbidedicated.models.ErrorResponseError """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__(self, *, error=None, **kwargs) -> None: super(ErrorResponse, self).__init__(**kwargs) - self.code = code - self.message = message + self.error = error class ErrorResponseException(HttpOperationError): @@ -261,6 +257,26 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +class ErrorResponseError(Model): + """The error object. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponseError, self).__init__(**kwargs) + self.code = code + self.message = message + + class Operation(Model): """Capacities REST API operation. diff --git a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/operations/_capacities_operations.py b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/operations/_capacities_operations.py index d225cc909367..91499c5e656c 100644 --- a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/operations/_capacities_operations.py +++ b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/operations/_capacities_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from msrest.polling import LROPoller, NoPolling from msrestazure.polling.arm_polling import ARMPolling @@ -60,7 +59,8 @@ def get_details( :return: DedicatedCapacity or ClientRawResponse if raw=true :rtype: ~azure.mgmt.powerbidedicated.models.DedicatedCapacity or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_details.metadata['url'] @@ -90,9 +90,7 @@ def get_details( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -140,9 +138,7 @@ def _create_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -184,7 +180,8 @@ def create( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.powerbidedicated.models.DedicatedCapacity] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.powerbidedicated.models.DedicatedCapacity]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ raw_result = self._create_initial( resource_group_name=resource_group_name, @@ -243,9 +240,7 @@ def _delete_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -271,7 +266,8 @@ def delete( ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ raw_result = self._delete_initial( resource_group_name=resource_group_name, @@ -330,9 +326,7 @@ def _update_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None @@ -373,7 +367,8 @@ def update( ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.powerbidedicated.models.DedicatedCapacity] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.powerbidedicated.models.DedicatedCapacity]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ raw_result = self._update_initial( resource_group_name=resource_group_name, @@ -432,9 +427,7 @@ def _suspend_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -460,7 +453,8 @@ def suspend( ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ raw_result = self._suspend_initial( resource_group_name=resource_group_name, @@ -514,9 +508,7 @@ def _resume_initial( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -542,7 +534,8 @@ def resume( ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ raw_result = self._resume_initial( resource_group_name=resource_group_name, @@ -582,7 +575,8 @@ def list_by_resource_group( :return: An iterator like instance of DedicatedCapacity :rtype: ~azure.mgmt.powerbidedicated.models.DedicatedCapacityPaged[~azure.mgmt.powerbidedicated.models.DedicatedCapacity] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -622,9 +616,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) return response @@ -649,7 +641,8 @@ def list( :return: An iterator like instance of DedicatedCapacity :rtype: ~azure.mgmt.powerbidedicated.models.DedicatedCapacityPaged[~azure.mgmt.powerbidedicated.models.DedicatedCapacity] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -688,9 +681,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) return response @@ -717,7 +708,8 @@ def list_skus( :rtype: ~azure.mgmt.powerbidedicated.models.SkuEnumerationForNewResourceResult or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.list_skus.metadata['url'] @@ -745,9 +737,7 @@ def list_skus( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -781,7 +771,8 @@ def list_skus_for_capacity( :rtype: ~azure.mgmt.powerbidedicated.models.SkuEnumerationForExistingResourceResult or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.list_skus_for_capacity.metadata['url'] @@ -811,9 +802,7 @@ def list_skus_for_capacity( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -846,7 +835,8 @@ def check_name_availability( :rtype: ~azure.mgmt.powerbidedicated.models.CheckCapacityNameAvailabilityResult or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ capacity_parameters = models.CheckCapacityNameAvailabilityParameters(name=name, type=type) @@ -881,9 +871,7 @@ def check_name_availability( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: