diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/CHANGELOG.md b/sdk/deviceupdate/azure-mgmt-deviceupdate/CHANGELOG.md index 3d519f260ed9..776e6f47eb38 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/CHANGELOG.md +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 1.0.0b2 (2021-03-24) + +**Breaking changes** + + - Model ErrorDefinition has a new signature + - Model ErrorResponse has a new signature + - Removed operation InstancesOperations.list_by_subscription + ## 1.0.0b1 (2021-03-02) * Initial Release diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_device_update.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_device_update.py index 00fa09589018..9f352f0cebc0 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_device_update.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_device_update.py @@ -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.accounts = AccountsOperations( diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_version.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_version.py index e5754a47ce68..dfa6ee022f15 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_version.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0b2" diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/_device_update.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/_device_update.py index 062ebe9f58d6..8292dad2cefc 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/_device_update.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/_device_update.py @@ -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.accounts = AccountsOperations( diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_accounts_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_accounts_operations.py index 3e430ec070a5..a714226ee632 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_accounts_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_accounts_operations.py @@ -99,7 +99,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -170,7 +170,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -229,7 +229,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -283,7 +283,7 @@ async def _create_initial( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize(_models.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -402,7 +402,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -517,7 +517,7 @@ async def _update_initial( 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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_instances_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_instances_operations.py index f88741f186b1..6124217fbf9f 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_instances_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_instances_operations.py @@ -43,77 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list_by_subscription( - self, - account_name: str, - **kwargs - ) -> AsyncIterable["_models.InstanceList"]: - """Returns instances for the given account name. - - :param account_name: Account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either InstanceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~device_update.models.InstanceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.InstanceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-03-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # 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'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]+$'), - } - 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') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('InstanceList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances'} # type: ignore - def list_by_account( self, resource_group_name: str, @@ -178,7 +107,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -241,7 +170,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) @@ -297,7 +226,7 @@ async def _create_initial( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize(_models.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) @@ -423,7 +352,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -560,7 +489,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_operations.py index e80ee89d8b63..ce6a85c8f52f 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_operations.py @@ -93,7 +93,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.ErrorDefinition, 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/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/__init__.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/__init__.py index 63a9fb222c6a..a8e84a81654f 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/__init__.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/__init__.py @@ -10,6 +10,7 @@ from ._models_py3 import Account from ._models_py3 import AccountList from ._models_py3 import AccountUpdate + from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDefinition from ._models_py3 import ErrorResponse from ._models_py3 import Instance @@ -25,6 +26,7 @@ from ._models import Account # type: ignore from ._models import AccountList # type: ignore from ._models import AccountUpdate # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore from ._models import ErrorDefinition # type: ignore from ._models import ErrorResponse # type: ignore from ._models import Instance # type: ignore @@ -47,6 +49,7 @@ 'Account', 'AccountList', 'AccountUpdate', + 'ErrorAdditionalInfo', 'ErrorDefinition', 'ErrorResponse', 'Instance', diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models.py index b25b32859988..3023dd9a2e0c 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models.py @@ -212,28 +212,51 @@ def __init__( self.location = kwargs.get('location', None) +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + 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 = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + class ErrorDefinition(msrest.serialization.Model): - """Error definition. + """Error response indicates that the service is not able to process the incoming request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error status code. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :param details: Error details. - :type details: list[~device_update.models.ErrorDefinition] + :ivar error: Error details. + :vartype error: ~device_update.models.ErrorResponse """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, + 'error': {'readonly': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, } def __init__( @@ -241,30 +264,40 @@ def __init__( **kwargs ): super(ErrorDefinition, self).__init__(**kwargs) - self.code = None - self.message = None - self.details = kwargs.get('details', None) + self.error = None class ErrorResponse(msrest.serialization.Model): - """Error response indicates that the service is not able to process the incoming request. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error status code. + :ivar code: The error code. :vartype code: str - :ivar error: Error details. - :vartype error: ~device_update.models.ErrorDefinition + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~device_update.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~device_update.models.ErrorAdditionalInfo] """ _validation = { 'code': {'readonly': True}, - 'error': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( @@ -273,7 +306,10 @@ def __init__( ): super(ErrorResponse, self).__init__(**kwargs) self.code = None - self.error = None + self.message = None + self.target = None + self.details = None + self.additional_info = None class Instance(TrackedResource): diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models_py3.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models_py3.py index ca0e4b992ac6..91b118bdc5c2 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models_py3.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models_py3.py @@ -228,61 +228,92 @@ def __init__( self.location = location +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + 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 = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + class ErrorDefinition(msrest.serialization.Model): - """Error definition. + """Error response indicates that the service is not able to process the incoming request. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error status code. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :param details: Error details. - :type details: list[~device_update.models.ErrorDefinition] + :ivar error: Error details. + :vartype error: ~device_update.models.ErrorResponse """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, + 'error': {'readonly': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, } def __init__( self, - *, - details: Optional[List["ErrorDefinition"]] = None, **kwargs ): super(ErrorDefinition, self).__init__(**kwargs) - self.code = None - self.message = None - self.details = details + self.error = None class ErrorResponse(msrest.serialization.Model): - """Error response indicates that the service is not able to process the incoming request. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error status code. + :ivar code: The error code. :vartype code: str - :ivar error: Error details. - :vartype error: ~device_update.models.ErrorDefinition + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~device_update.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~device_update.models.ErrorAdditionalInfo] """ _validation = { 'code': {'readonly': True}, - 'error': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( @@ -291,7 +322,10 @@ def __init__( ): super(ErrorResponse, self).__init__(**kwargs) self.code = None - self.error = None + self.message = None + self.target = None + self.details = None + self.additional_info = None class Instance(TrackedResource): diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_accounts_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_accounts_operations.py index 2ba3019605b5..3c46c3707b89 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_accounts_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_accounts_operations.py @@ -104,7 +104,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -176,7 +176,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -236,7 +236,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -291,7 +291,7 @@ def _create_initial( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize(_models.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -412,7 +412,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -529,7 +529,7 @@ def _update_initial( 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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py index 25c7728ea5e9..1aca3641c2cd 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_instances_operations.py @@ -47,78 +47,6 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list_by_subscription( - self, - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.InstanceList"] - """Returns instances for the given account name. - - :param account_name: Account name. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either InstanceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~device_update.models.InstanceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.InstanceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-03-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # 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'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[A-Za-z][A-Za-z0-9]+$'), - } - 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') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('InstanceList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - 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) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances'} # type: ignore - def list_by_account( self, resource_group_name, # type: str @@ -184,7 +112,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -248,7 +176,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) @@ -305,7 +233,7 @@ def _create_initial( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize(_models.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) @@ -433,7 +361,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -572,7 +500,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.ErrorDefinition, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Instance', pipeline_response) diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_operations.py b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_operations.py index da7a94836a7a..b7cf219d43f1 100644 --- a/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_operations.py +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/operations/_operations.py @@ -98,7 +98,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.ErrorDefinition, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)