diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py index 7eab5bc5a910..d65b71635257 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py @@ -402,12 +402,63 @@ def __init__(self, **kwargs): class CloudError(Model): - """CloudError. + """An error response from the Storage service. + + :param error: + :type error: ~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody """ _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, } + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Storage service. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, **kwargs): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + class CorsRule(Model): """Specifies a CORS rule for the Blob service. @@ -748,66 +799,6 @@ def __init__(self, **kwargs): self.dfs = None -class ErrorResponse(Model): - """An error response from the Storage service. - - :param error: - :type error: ~azure.mgmt.storage.v2019_04_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__(self, **kwargs): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) - - -class ErrorResponseBody(Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.storage.v2019_04_01.models.ErrorResponseBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, - } - - def __init__(self, **kwargs): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - class FileServiceItems(Model): """FileServiceItems. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py index e8d2a1d88e13..4bbb299a95bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py @@ -402,12 +402,63 @@ def __init__(self, **kwargs) -> None: class CloudError(Model): - """CloudError. + """An error response from the Storage service. + + :param error: + :type error: ~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody """ _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, } + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Storage service. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + class CorsRule(Model): """Specifies a CORS rule for the Blob service. @@ -748,66 +799,6 @@ def __init__(self, **kwargs) -> None: self.dfs = None -class ErrorResponse(Model): - """An error response from the Storage service. - - :param error: - :type error: ~azure.mgmt.storage.v2019_04_01.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) - - -class ErrorResponseBody(Model): - """An error response from the Storage service. - - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.storage.v2019_04_01.models.ErrorResponseBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, - } - - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - class FileServiceItems(Model): """FileServiceItems. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py index 2f69fef9ccbf..f4a2afc781e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from .. import models @@ -59,8 +60,7 @@ def list( :return: FileServiceItems or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceItems or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ # Construct URL url = self.list.metadata['url'] @@ -90,7 +90,9 @@ def list( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: @@ -128,8 +130,7 @@ def set_service_properties( :return: FileServiceProperties or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ parameters = models.FileServiceProperties(cors=cors) @@ -166,7 +167,9 @@ def set_service_properties( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: @@ -199,8 +202,7 @@ def get_service_properties( :return: FileServiceProperties or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ # Construct URL url = self.get_service_properties.metadata['url'] @@ -231,7 +233,9 @@ def get_service_properties( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py index 31b970865ea4..b874ff7f630d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from .. import models @@ -66,8 +67,7 @@ def list( :return: An iterator like instance of FileShareItem :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShareItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ def prepare_request(next_link=None): if not next_link: @@ -114,7 +114,9 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp return response @@ -161,8 +163,7 @@ def create( :return: FileShare or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ file_share = models.FileShare(metadata=metadata, share_quota=share_quota) @@ -199,7 +200,9 @@ def create( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: @@ -247,8 +250,7 @@ def update( :return: FileShare or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ file_share = models.FileShare(metadata=metadata, share_quota=share_quota) @@ -285,7 +287,9 @@ def update( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: @@ -323,8 +327,7 @@ def get( :return: FileShare or ClientRawResponse if raw=true :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ # Construct URL url = self.get.metadata['url'] @@ -355,7 +358,9 @@ def get( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: @@ -392,8 +397,7 @@ def delete( overrides`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :raises: :class:`CloudError` """ # Construct URL url = self.delete.metadata['url'] @@ -423,7 +427,9 @@ def delete( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 204]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp if raw: client_raw_response = ClientRawResponse(None, response)