Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR storage/resource-manager] Rename errorResponse to align with other RPs #7058

Merged
merged 2 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Generated from 3658b509eba17c55f99d9e22c28e55cb88e33ac0
Rename errorResponse to align with other RPs
  • Loading branch information
AutorestCI committed Sep 4, 2019
commit 17b054635ade1221bf06c620f99dfc3568edeb43
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,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.
Expand Down Expand Up @@ -727,66 +778,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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,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.
Expand Down Expand Up @@ -727,66 +778,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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError

from .. import models

Expand Down Expand Up @@ -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<azure.mgmt.storage.v2019_04_01.models.ErrorResponseException>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list.metadata['url']
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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<azure.mgmt.storage.v2019_04_01.models.ErrorResponseException>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
parameters = models.FileServiceProperties(cors=cors)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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<azure.mgmt.storage.v2019_04_01.models.ErrorResponseException>`
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_service_properties.metadata['url']
Expand Down Expand Up @@ -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:
Expand Down
Loading